Skip to content

Commit

Permalink
fix: resolve invalid next config warnings
Browse files Browse the repository at this point in the history
- remove next-compose plugins, doing it manually
- set `assetPrefix` as undefined if `hasAssetPrefix` is false
- remove `autoPrerender` as not supported any more
  • Loading branch information
mohitb35 committed Feb 20, 2023
1 parent 2c9ca1a commit 1d21b05
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 28 deletions.
19 changes: 11 additions & 8 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const withPlugins = require("next-compose-plugins");
const withBundleAnalyzer = require("@next/bundle-analyzer")({
enabled: process.env.ANALYZE === "true",
});
Expand Down Expand Up @@ -45,7 +44,7 @@ if (process.env.NEXT_PUBLIC_VERCEL_ENV === "preview") {
const hasAssetPrefix =
process.env.ASSET_PREFIX !== "" && process.env.ASSET_PREFIX !== undefined;

module.exports = withPlugins([[withBundleAnalyzer]], {
const nextConfig = {
productionBrowserSourceMaps: true,
serverRuntimeConfig: {
rootDir: __dirname,
Expand Down Expand Up @@ -100,9 +99,6 @@ module.exports = withPlugins([[withBundleAnalyzer]], {
},
basePath,
// your config for other plugins or the general next.js here...
devIndicators: {
autoPrerender: false,
},
env: {
AUTH0_CUSTOM_DOMAIN: process.env.AUTH0_CUSTOM_DOMAIN,
AUTH0_CLIENT_ID: process.env.AUTH0_CLIENT_ID,
Expand All @@ -114,7 +110,7 @@ module.exports = withPlugins([[withBundleAnalyzer]], {
ESRI_CLIENT_ID: process.env.ESRI_CLIENT_ID,
ESRI_CLIENT_SECRET: process.env.ESRI_CLIENT_SECRET,
RECURRENCY: process.env.RECURRENCY,
TRACKING_KEY: process.env.TRACKING_KEY
TRACKING_KEY: process.env.TRACKING_KEY,
},
trailingSlash: false,
reactStrictMode: true,
Expand All @@ -126,11 +122,18 @@ module.exports = withPlugins([[withBundleAnalyzer]], {
// !! WARN !!
ignoreBuildErrors: true,
},
assetPrefix: hasAssetPrefix ? `${scheme}://${process.env.ASSET_PREFIX}` : "",
assetPrefix: hasAssetPrefix
? `${scheme}://${process.env.ASSET_PREFIX}`
: undefined,
// Asset Prefix allows to use CDN for the generated js files
// https://nextjs.org/docs/api-reference/next.config.js/cdn-support-with-asset-prefix
i18n,
images: {
domains: ["cdn.plant-for-the-planet.org", "cdn.planetapp.workers.dev"],
},
});
};

module.exports = () => {
const plugins = [withBundleAnalyzer];
return plugins.reduce((config, plugin) => plugin(config), nextConfig);
};
51 changes: 32 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"geocoder-arcgis": "^2.0.5",
"jwt-decode": "^3.1.2",
"next": "^13.1.6",
"next-compose-plugins": "^2.2.1",
"next-i18next": "^13.1.5",
"playwright-core": "^1.25.0",
"react": "^18.2.0",
Expand Down

0 comments on commit 1d21b05

Please sign in to comment.