Created
November 2, 2021 20:12
-
-
Save markerikson/d45d4a27fd119494b386b0e40826bd54 to your computer and use it in GitHub Desktop.
Work app Next.js config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// omit imports and stuff | |
// Using Next 11.1 | |
module.exports = withPlugins( | |
[ | |
withBundleAnalyzer({ | |
enabled: process.env.ANALYZE === 'true' | |
}) | |
], | |
{ | |
// Expose EMR app config values to all server-side Next code | |
serverRuntimeConfig: config, | |
// Generate sourcemaps for prod builds | |
productionBrowserSourceMaps: true, | |
// Use Webpack 5 instead of WP4 | |
webpack5: true, | |
eslint: { | |
// Don't run additional ESLint checks during builds - we do that ourselves | |
ignoreDuringBuilds: true | |
}, | |
webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => { | |
const resolvedBaseUrl = path.resolve(config.context, '..'); | |
// This extra config allows to use paths defined in tsconfig | |
// @link https://github.com/vercel/next.js/pull/13542 | |
Object.assign(config.resolve.alias, hq.get('webpack')); | |
config.module.rules = [ | |
...config.module.rules, | |
{ | |
test: /\.(tsx|ts|js|mjs|jsx)$/, | |
include: [resolvedBaseUrl], | |
use: defaultLoaders.babel, | |
exclude: excludePath => { | |
return /node_modules/.test(excludePath); | |
} | |
} | |
]; | |
config.plugins.push( | |
new CircularDependencyPlugin({ | |
failOnError: true, | |
exclude: /node_modules|graphQL/i, | |
cwd: process.cwd() | |
}) | |
); | |
return config; | |
} | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment