-
-
Notifications
You must be signed in to change notification settings - Fork 387
Closed
Description
Bug report
When I configure mini-css-extract-plugin in conjunction with css-loader and exportLocalsOnly
I encounter an error.
Reproducible repo: https://github.com/Istanful/export-locals-only-mini-css-error
Actual Behavior
When I configure mini-css-extract-plugin in conjunction with css-loader and exportLocalsOnly
I encounter an error.
Expected Behavior
It should ignore that no default export exists and compile anyways.
How Do We Reproduce?
I create a webpack.config.js file. This is the relevant configuration.
{
test: /\.css$/i,
use: [
{
loader: MiniCssExtractPlugin.loader,
},
{
loader: "css-loader",
options: {
esModule: true,
modules: {
namedExport: true,
exportLocalsConvention: "camelCaseOnly",
localIdentName: "[path][name]__[local]--[hash:base64:5]",
},
},
},
],
},
When I then run webpack serve
I get the following error:
TypeError: Cannot use 'in' operator to search for 'locals' in undefined
It happens here as it tries to check if locals is in the default export.
I wish to not have a default export as I want to only use CSS module locals.
Please paste the results of npx webpack-cli info
here, and mention other relevant information
System:
OS: macOS 10.15.7
CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Memory: 561.29 MB / 16.00 GB
Binaries:
Node: 12.18.3 - /usr/local/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 6.14.6 - /usr/local/bin/npm
Browsers:
Chrome: 94.0.4606.71
Safari: 14.1.2
Packages:
extract-text-webpack-plugin: ^3.0.2 => 3.0.2
webpack: ^5.54.0 => 5.54.0
webpack-cli: ^4.8.0 => 4.8.0
webpack-dev-server: ^4.3.0 => 4.3.0
Metadata
Metadata
Assignees
Labels
No labels