Skip to content

Commit

Permalink
fix: infinity applying loaders leading to memory allocation fail (#849)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait authored Oct 7, 2021
1 parent 481063d commit 94ad699
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export function pitch(request) {
)}`;

this.importModule(
`${this.resourcePath}.webpack[javascript/auto]!=!${request}`,
`${this.resourcePath}.webpack[javascript/auto]!=!!!${request}`,
{
layer: options.layer,
publicPath: publicPathForExtract,
Expand Down Expand Up @@ -366,4 +366,6 @@ export function pitch(request) {
}

// eslint-disable-next-line func-names
export default function () {}
export default function (content) {
console.log(content);
}
4 changes: 4 additions & 0 deletions test/cases/ignore-other-loaders/expected/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
body {
background: red;
}

1 change: 1 addition & 0 deletions test/cases/ignore-other-loaders/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "./style.css";
3 changes: 3 additions & 0 deletions test/cases/ignore-other-loaders/other.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.color {
color: red;
}
3 changes: 3 additions & 0 deletions test/cases/ignore-other-loaders/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
background: red;
}
23 changes: 23 additions & 0 deletions test/cases/ignore-other-loaders/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import Self from "../../../src";

module.exports = {
entry: "./index.js",
module: {
rules: [
{
test: /\.css|\.less$/,
use: [
{
loader: Self.loader,
},
"css-loader",
],
},
],
},
plugins: [
new Self({
filename: "[name].css",
}),
],
};

0 comments on commit 94ad699

Please sign in to comment.