Files
mwitnessing/next.config.js
Dobromir Popov 7e7e01f14c various fixes to imports and filtering;
some API rewrited
2024-04-11 02:38:36 +03:00

53 lines
1.3 KiB
JavaScript

const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const withPWA = require('next-pwa')({
dest: 'public',
register: true, // ?
publicExcludes: ["!_error*.js"], //?
disable: process.env.NODE_ENV === 'development',
})
module.exports = withPWA({
typescript: {
// !! WARN !!
// Dangerously allow production builds to successfully complete even if
// your project has type errors.
// !! WARN !!
ignoreBuildErrors: true,
},
compress: false,
pageExtensions: ['ts', 'tsx', 'md', 'mdx'], // Replace `jsx?` with `tsx?`
env: {
env: process.env.NODE_ENV,
server: process.env.NEXT_PUBLIC_PUBLIC_URL
},
webpack(config, { isServer }) {
config.optimization.minimize = true,
productionBrowserSourceMaps = true,
config.resolve.fallback = {
// if you miss it, all the other options in fallback, specified
// by next.js will be dropped.
...config.resolve.fallback,
fs: false, // the solution
};
// Only run the bundle analyzer for production builds and when the ANALYZE environment variable is set
if (process.env.ANALYZE && !isServer) {
config.plugins.push(
new BundleAnalyzerPlugin({
analyzerMode: 'static',
openAnalyzer: true,
generateStatsFile: true,
})
);
}
return config;
},
})