codymikol / karma-webpack

Karma webpack Middleware
MIT License
829 stars 220 forks source link

fix(controller): disallow custom optiomization #578

Closed codymikol closed 9 months ago

codymikol commented 9 months ago

this will often break the inner workings of karma-webpack due to a number of issues coming in about this in particular it has been decided that it is best to ignore these kinds of customization and log a warning that they are discarded

Fixes #491

lwr commented 3 weeks ago

As #587 mentioned, this is a breaking change.

Although #588 restore the previous behavior but still output a warning.

We are running unit tests with karma with minify codes (using terser), which is required to ensuring that any unexpected result after minify process should not happened.

Prior to this changes, we just keep minimizer and remove all other optimization options before running tests, but now it always leads to a breaking or warning.

Is there any other way to specify such as a terser options after "upgrade" to karma-webpack@5.0.x

lwr commented 3 weeks ago

OK we will take this workarounds

// karma.conf.js

const webpackConfig = ...
const {minimizer} = webpackConfig.optimization;
delete webpackConfig.optimization; // workarounds https://github.com/codymikol/karma-webpack/pull/578#issuecomment-2185779635
webpackConfig.plugins.push({apply : compiler => { compiler.options.optimization.minimizer = minimizer }});

We hope we can have this done in a more elegant way

codymikol commented 3 weeks ago

I have a fix pending release, but my ssd gave out so it set me back quite a bit 😕