Skip to content

Commit 59e703c

Browse files
committed
Add depth counter to avoid recursive overlap
1 parent e45652d commit 59e703c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/extractLoader.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ function evalDependencyGraph({loaderContext, src, filename, publicPath = ""}) {
107107
plugins: [require("babel-plugin-add-module-exports")],
108108
}).code;
109109

110+
const curVmDepth = global.__EXTRACT_LOADER_PLACEHOLDER__DEPTH__ || 0;
111+
110112
const script = new vm.Script(src, {
111113
filename,
112114
displayErrors: true,
@@ -147,7 +149,7 @@ function evalDependencyGraph({loaderContext, src, filename, publicPath = ""}) {
147149
return exports;
148150
}
149151

150-
const extractPlaceholder = "__EXTRACT_LOADER_PLACEHOLDER__" + counterNumber() + "__";
152+
const extractPlaceholder = "__EXTRACT_LOADER_PLACEHOLDER__" + curVmDepth + "__" + counterNumber() + "__";
151153

152154
newDependencies.push({
153155
absolutePath,
@@ -157,6 +159,7 @@ function evalDependencyGraph({loaderContext, src, filename, publicPath = ""}) {
157159

158160
return extractPlaceholder;
159161
},
162+
__EXTRACT_LOADER_PLACEHOLDER__DEPTH__: curVmDepth + 1,
160163
});
161164

162165
script.runInNewContext(sandbox);

0 commit comments

Comments
 (0)