這issue十分空泛,或許對某些人有幫助
Condition
部屬nextra到github page時,在Setup Page時出了問題,一直以為是next.config.js
有function沒寫好
Solution
在actions/configure-pages@v5提供的nextjs.yml
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
with:
# Automatically inject basePath in your Next.js configuration file and disable
# server side image optimization (https://nextjs.org/docs/api-reference/next/image#unoptimized).
#
# You may remove this line if you want to manage the configuration yourself.
static_site_generator: next
註解這個block,static_site_generator: next
有點問題,自己設定next.config.js
的basePath、assetPrefix
供參考
//next.config.js
const isProd = process.env.NODE_ENV === 'production'
const withNextra = require('nextra')({
theme: 'nextra-theme-docs',
themeConfig: './theme.config.jsx',
})
const nextConfig = {
basePath: process.env.BASE_PATH,
assetPrefix: process.env.ASSET_PREFIX,
reactStrictMode: true,
output: isProd ? 'export' : 'standalone',
distDir: 'dist',
images: {
unoptimized: true,
}
}
module.exports = withNextra(nextConfig)