Skip to content

Commit 240e0f3

Browse files
author
Marc Eickhoff
committed
Fixed issue with webpack config injection
1 parent b294efd commit 240e0f3

File tree

3 files changed

+109
-187
lines changed

3 files changed

+109
-187
lines changed

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@ class CleanCss {
3737
webpackConfig.module.rules.forEach(function (rule) {
3838

3939
// Skip rules without loaders
40-
if (typeof rule.loaders === "undefined") return;
40+
if (typeof rule.use === "undefined") return;
4141

4242
// Go through all loaders of a rule
43-
rule.loaders.forEach(function (loader) {
43+
rule.use.forEach(function (loader) {
4444

4545
// Search for postcss-loader
4646
if (typeof loader === "object" && loader.loader === insertBefore) {
4747

4848
// Insert clean-css right before
49-
rule.loaders.splice(rule.loaders.indexOf(insertBefore) - 1, 0, {
49+
rule.use.splice(rule.use.indexOf(insertBefore) - 1, 0, {
5050
loader: "clean-css-loader",
5151
options: options
5252
});

0 commit comments

Comments
 (0)