Uncaught TypeError
when using multiple files per entry
on Webpack v5
#560
Labels
Uncaught TypeError
when using multiple files per entry
on Webpack v5
#560
10.16.01
1.21.1
5.0.0-beta.23
0.9.0
Expected Behavior
With v5, Webpack now supports specifying multiple files per entry as well as the
dependOn
key (see docs here).Example:
Previously, Webpack v4 supported multiple files OR specifying an object with
dependOn
. As far as I can tell from their v5 docs, the above example is newly added and this is not something that was supported in v4(For context,
dependOn
allows certain packs (entry points) to depend on others and is a way of splitting out packs into smaller chunks but still maintaining a "common" or "shared" chunk.)Actual Behavior
When implementing the above approach with Webpack v5 (
beta.23
) andmini-css-extract-plugin
(0.9.0
), I get the below error. (seeCode
section below for implementation details)Specifically this error references the following lines in the compiled JavaScript pack
As shown, it's treating the object
{"common": 0}
like a function and calling it with an argument (and then assigning the result toinstalledCssChunks
)Code
Here is my full webpack config, where you can see how
MiniCssExtractPlugin
is defined and used.The
entry
key specifically is presented below. As you can see, it's using the new Webpack v5 functionality that allows defining multiple files per entry point along withdependOn
.The idea is that all packs depend on
common
and each pack is made up of a JS and CSS file.The CSS file is processed by
mini-css-extract-plugin
(and has historically worked well for me in production).How Do We Reproduce?
5.0.0-beta.23
mini-css-extract-plugin
0.9.0
dependOn
admin
in my example above). Verify whether the compiledadmin.js
andadmin.css
webpack assets load successfully.The text was updated successfully, but these errors were encountered: