Skip to content

Commit c4b80b4

Browse files
fix: css experiments logic
1 parent 14e731e commit c4b80b4

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/index.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ const loader = function loader(content) {
3030
this._compiler.options.experiments &&
3131
this._compiler.options.experiments.css &&
3232
this._module &&
33-
this._module.type === "css"
33+
(this._module.type === "css" ||
34+
this._module.type === "css/global" ||
35+
this._module.type === "css/module" ||
36+
this._module.type === "css/auto")
3437
) {
3538
return content;
3639
}
@@ -43,7 +46,10 @@ loader.pitch = function pitch(request) {
4346
this._compiler.options.experiments &&
4447
this._compiler.options.experiments.css &&
4548
this._module &&
46-
this._module.type === "css"
49+
(this._module.type === "css" ||
50+
this._module.type === "css/global" ||
51+
this._module.type === "css/module" ||
52+
this._module.type === "css/auto")
4753
) {
4854
this.emitWarning(
4955
new Error(

test/__snapshots__/loader.test.js.snap

-4
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,8 @@ exports[`loader should do nothing with built-in CSS support: errors 1`] = `Array
44

55
exports[`loader should do nothing with built-in CSS support: warnings 1`] = `
66
Array [
7-
"ModuleWarning: Module Warning (from ../../node_modules/css-loader/dist/cjs.js):
8-
You can't use \`experiments.css\` (\`experiments.futureDefaults\` enable built-in CSS support by default) and \`css-loader\` together, please set \`experiments.css\` to \`false\` or set \`{ type: \\"javascript/auto\\" }\` for rules with \`css-loader\` in your webpack config (now css-loader does nothing).",
97
"ModuleWarning: Module Warning (from ../../src/cjs.js):
108
You can't use \`experiments.css\` (\`experiments.futureDefaults\` enable built-in CSS support by default) and \`style-loader\` together, please set \`experiments.css\` to \`false\` or set \`{ type: \\"javascript/auto\\" }\` for rules with \`style-loader\` in your webpack config (now \`style-loader\` does nothing).",
11-
"ModuleWarning: Module Warning (from ../../node_modules/css-loader/dist/cjs.js):
12-
You can't use \`experiments.css\` (\`experiments.futureDefaults\` enable built-in CSS support by default) and \`css-loader\` together, please set \`experiments.css\` to \`false\` or set \`{ type: \\"javascript/auto\\" }\` for rules with \`css-loader\` in your webpack config (now css-loader does nothing).",
139
"ModuleWarning: Module Warning (from ../../src/cjs.js):
1410
You can't use \`experiments.css\` (\`experiments.futureDefaults\` enable built-in CSS support by default) and \`style-loader\` together, please set \`experiments.css\` to \`false\` or set \`{ type: \\"javascript/auto\\" }\` for rules with \`style-loader\` in your webpack config (now \`style-loader\` does nothing).",
1511
]

0 commit comments

Comments
 (0)