This commit is contained in:
parent
82307585bd
commit
8a7c4b7ccf
@ -1,23 +1,22 @@
|
||||
// next.config.js
|
||||
const webpack = require('webpack')
|
||||
const withBundleAnalyzer = require('@next/bundle-analyzer')({
|
||||
enabled: process.env.ANALYZE === 'true'
|
||||
})
|
||||
|
||||
const envMap = Object.keys(process.env)
|
||||
.filter(key => key.startsWith('CERC_'))
|
||||
.reduce((acc, key) => {
|
||||
acc[`process.env.${key}`] = JSON.stringify(process.env[key])
|
||||
return acc
|
||||
}, {})
|
||||
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
reactStrictMode: false,
|
||||
swcMinify: true,
|
||||
webpack: (config) => {
|
||||
config.plugins.push(new webpack.DefinePlugin(envMap))
|
||||
// Let the build script handle the DefinePlugin injection
|
||||
// The script will add the envMap DefinePlugin automatically
|
||||
return config
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = withBundleAnalyzer(nextConfig)
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
// Let the build script transform this
|
||||
const __orig_cfg__ = withBundleAnalyzer(nextConfig)
|
||||
} else {
|
||||
// For development, export directly
|
||||
module.exports = withBundleAnalyzer(nextConfig)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user