Closed knilink closed 10 months ago
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!
Expected Behavior
https://github.com/ryanclark/karma-webpack/blob/e2423b47ec59059bc1808c670affa64d0f5aa8b7/lib/karma-webpack/controller.js#L34
newOptions.splitChunks.cacheGroups = {myChunk: {...}}
options.splitChunks.cacheGroups
to be{myChunk: {...}}
Actual Behavior
options.splitChunks.cacheGroups
is{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
karma-webpack@5.0.0
, 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