This repository has been archived by the owner on Feb 18, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve error message when legacy minimizer syntax used
In #84 (released as part of webpack-chain 5.0.0) the syntax for using `optimization.minimizer` was altered, so that it matched that for `plugin`, `resolve.plugin` and `resolveLoader.plugin`. Syntax in webpack-chain 4: ``` config.optimization.minimizer([ new WebpackPluginFoo(), new WebpackPluginBar(arg1, arg2), ]); ``` Syntax in webpack-chain 5+: ``` config.optimization.minimizer('foo').use(WebpackPluginFoo); config.optimization.minimizer('bar').use(WebpackPluginBar, [arg1, arg2]); ``` Currently if someone uses the old syntax with newer webpack-chain, then the `minimizer()` call succeeds, but later when `.toConfig()` is called, the following error is generated: `TypeError: Cannot read property '__expression' of undefined` This PR adds an explicit check to `optimization.minimizer()` which ensures a clearer error message is shown at point of use, so that the stack trace is more relevant, and root cause clearer. Refs: #204 (comment)
- Loading branch information