Skip to content

Commit e70047d

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

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/extractLoader.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ 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;
110111
const script = new vm.Script(src, {
111112
filename,
112113
displayErrors: true,
@@ -147,7 +148,7 @@ function evalDependencyGraph({loaderContext, src, filename, publicPath = ""}) {
147148
return exports;
148149
}
149150

150-
const extractPlaceholder = "__EXTRACT_LOADER_PLACEHOLDER__" + counterNumber() + "__";
151+
const extractPlaceholder = "__EXTRACT_LOADER_PLACEHOLDER__" + curVmDepth + "__" + counterNumber() + "__";
151152

152153
newDependencies.push({
153154
absolutePath,
@@ -157,6 +158,7 @@ function evalDependencyGraph({loaderContext, src, filename, publicPath = ""}) {
157158

158159
return extractPlaceholder;
159160
},
161+
__EXTRACT_LOADER_PLACEHOLDER__DEPTH__: curVmDepth + 1,
160162
});
161163

162164
script.runInNewContext(sandbox);

0 commit comments

Comments
 (0)