Skip to content

Commit 94ad699

Browse files
fix: infinity applying loaders leading to memory allocation fail (#849)
1 parent 481063d commit 94ad699

File tree

6 files changed

+38
-2
lines changed

6 files changed

+38
-2
lines changed

src/loader.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ export function pitch(request) {
213213
)}`;
214214

215215
this.importModule(
216-
`${this.resourcePath}.webpack[javascript/auto]!=!${request}`,
216+
`${this.resourcePath}.webpack[javascript/auto]!=!!!${request}`,
217217
{
218218
layer: options.layer,
219219
publicPath: publicPathForExtract,
@@ -366,4 +366,6 @@ export function pitch(request) {
366366
}
367367

368368
// eslint-disable-next-line func-names
369-
export default function () {}
369+
export default function (content) {
370+
console.log(content);
371+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
body {
2+
background: red;
3+
}
4+
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import "./style.css";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.color {
2+
color: red;
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
background: red;
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import Self from "../../../src";
2+
3+
module.exports = {
4+
entry: "./index.js",
5+
module: {
6+
rules: [
7+
{
8+
test: /\.css|\.less$/,
9+
use: [
10+
{
11+
loader: Self.loader,
12+
},
13+
"css-loader",
14+
],
15+
},
16+
],
17+
},
18+
plugins: [
19+
new Self({
20+
filename: "[name].css",
21+
}),
22+
],
23+
};

0 commit comments

Comments
 (0)