From bd51bdcca385c684e977e3de6046321f3388a67e Mon Sep 17 00:00:00 2001 From: Dima Vyshniakov Date: Fri, 17 May 2024 13:21:27 +0200 Subject: [PATCH] fix pages build --- .github/workflows/pages.yml | 7 +++++-- next.config.js | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 9a66003..ccf679f 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -74,6 +74,11 @@ jobs: restore-keys: | ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}- + - name: Set up pages build envrinonment variable + run: | + touch .env + echo PAGES_BUILD=true >> .env + - name: Build docs run: | pnpm install @@ -81,8 +86,6 @@ jobs: - name: Setup Pages uses: actions/configure-pages@v5 - with: - static_site_generator: next - name: Upload artifact uses: actions/upload-pages-artifact@v3 diff --git a/next.config.js b/next.config.js index 91a2c5f..65be271 100644 --- a/next.config.js +++ b/next.config.js @@ -1,4 +1,4 @@ -/* Enable bundle analysis. Run `pnpm run analyze:build` to get report */ +/* Enable bundle analysis. Run `yarn analyze:build` to get report */ /* eslint-disable-next-line import/no-extraneous-dependencies, @typescript-eslint/no-var-requires */ const withBundleAnalyzer = require('@next/bundle-analyzer')({ enabled: process.env.ANALYZE === 'true', @@ -9,5 +9,7 @@ module.exports = withBundleAnalyzer({ reactStrictMode: true, swcMinify: true, distDir: 'build', + output: process.env.PAGES_BUILD === 'true' ? 'export' : undefined, cleanDistDir: true, + basePath: process.env.PAGES_BUILD === 'true' ? '/ts-redux-next' : undefined, });