I want to create a "sentry" chunk file in next.config.js.
I tried to implement like following in next.config.js:
webpack(config, { isServer }) {
config.optimization.splitChunks.cacheGroups = {
...config.optimization.splitChunks.cacheGroups,
'sentry': {
test: /[\\/]node_modules[\\/](@sentry)[\\/]/,
name: '@sentry',
priority: 10,
reuseExistingChunk: false,
},
};
return config;
}
When I try to run the application it is showing this error:
TypeError: Cannot create property 'cacheGroups' on boolean 'false'
How can I create a chunk in nextjs with webpack custom configuration?
Thanks