codymikol / karma-webpack

Karma webpack Middleware
MIT License
829 stars 222 forks source link

merging cacheGroups causes confusion #490

Closed knilink closed 10 months ago

knilink commented 3 years ago

Expected Behavior

https://github.com/ryanclark/karma-webpack/blob/e2423b47ec59059bc1808c670affa64d0f5aa8b7/lib/karma-webpack/controller.js#L34

Actual Behavior

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

lk77 commented 3 years 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

codymikol commented 10 months ago

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!