Next Deploy Github Page
-
在project root新增
.github/workflows/deploy.yml
-
next.config.js 新增
const isProd = process.env.NODE_ENV === 'production'
-
module.exports = { ... assetPrefix: isProd ? '/j-p1/' : '' }
- example
/** @type {import('next').NextConfig} */ // const isProd = process.env.NODE_ENV === 'production' const nextConfig = { reactStrictMode: true, assetPrefix: isProd ? '/j-p1/' : '' } module.exports = nextConfig
-
設定
package.json
“scripts”: { “dev”: “next dev”, “build”: “next build”, “start”: “next start”, “lint”: “next lint”, “export”: “next export” },
FAQ
- Action問題、ssh