Skip to content

Commit

Permalink
ci: export Next build conditionally for linkinator (#369)
Browse files Browse the repository at this point in the history
  • Loading branch information
fadeev authored Jun 24, 2024
1 parent 3df8eda commit 90c2680
Show file tree
Hide file tree
Showing 3 changed files with 473 additions and 473 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-links.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
run: yarn

- name: Build project
run: yarn build
run: EXPORT=true yarn build

- name: Check for broken links
run: yarn check-links
16 changes: 8 additions & 8 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,15 @@ const withNextra = require("nextra")(nextraConfig);
const { nextHeadersConfig } = require("./src/config/headers.config.json");

/** @type {import('next').NextConfig} */
const nextConfig = {
images: { unoptimized: true },
output: "export",
const baseNextConfig = {
reactStrictMode: true,

transpilePackages: ["@zetachain/ui-toolkit"],
experimental: {
externalDir: true,
},

trailingSlash: true,
basePath: process.env.NEXT_PUBLIC_BASE_PATH,

headers: async () => nextHeadersConfig,

webpack(config) {
// eslint-disable-next-line no-param-reassign
config.resolve.fallback = {
Expand All @@ -48,6 +42,12 @@ const nextConfig = {
},
};

const configWithNextra = withNextra(nextConfig);
// Run next build with EXPORT env var set to make a static build compatible with linkinator
if (process.env.EXPORT) {
baseNextConfig.images = { unoptimized: true };
baseNextConfig.output = "export";
}

const configWithNextra = withNextra(baseNextConfig);

module.exports = withBundleAnalyzer(configWithNextra);
Loading

0 comments on commit 90c2680

Please sign in to comment.