merging cacheGroups causes confusion
- Operating System: MacOS 10.15.7
- Node Version: 14.15.0
- NPM Version: 6.14.0
- webpack Version: 5.11.1
- karma-webpack Version: 5.0.0
Expected Behavior
https://github.com/ryanclark/karma-webpack/blob/e2423b47ec59059bc1808c670affa64d0f5aa8b7/lib/karma-webpack/controller.js#L34
- GIVEN
newOptions.splitChunks.cacheGroups = {myChunk: {...}} - WHEN merging with karma-webpack's default webpack option
- EXPECT
options.splitChunks.cacheGroupsto be{myChunk: {...}}
Actual Behavior
- ACTUAL
options.splitChunks.cacheGroupsis{myChunk: {...}, commons: {..}}
Context
I'm currently debugging some sourcemap issues with coffeescript(doesn't seem to support eval sourcemap) after upgrading to webpack 5 and discovered that karma-sourcemap-loader wouldn't process split chunks which are not listed in karma preprocessors. Before, I only split out vendor files and the rest stayed in the entry chunks so it's fine. With [email protected], the commons chunk in the default config split the rest of the code from the entry and break the source map.
It may not exactly be a bug but I find it really confusing. Also, doesn't seem to have a way to unset the default one.
related issue https://github.com/ryanclark/karma-webpack/issues/489
Hello,
same issue here, i want to get rid of commons cache group, and it does not seems to work.
i tried this to enforce my webpack config :
const webpackConfig = require('./webpack.config.test.js');
let DefaultWebpackOptionsFactory = require('karma-webpack/lib/webpack/defaults');
DefaultWebpackOptionsFactory.create = () => {
return webpackConfig;
};
require.cache[require.resolve('karma-webpack/lib/webpack/defaults')].exports = DefaultWebpackOptionsFactory;
edit:
when using this solution, be sure to do webpack: {} in your karma config, to not have issue when merging
As karma is now deprecated and coming up on EOL, we are no longer planning on any significant enhancements to this project and are instead going to focus on security updates, stability, and a migration path forward as karma's lifecycle comes to an end.
Thank you for supporting and using this project!