Commit fbf92fe 1 parent b9fb99c commit fbf92fe Copy full SHA for fbf92fe
File tree 1 file changed +8
-1
lines changed
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -435,6 +435,10 @@ class JavascriptParser extends Parser {
435
435
/** @type {WeakMap<Expression, Set<string>> | undefined } */
436
436
this . destructuringAssignmentProperties = undefined ;
437
437
this . currentTagData = undefined ;
438
+ this . magicCommentContext = vm . createContext ( undefined , {
439
+ name : "Webpack Magic Comment Parser" ,
440
+ codeGeneration : { strings : false , wasm : false }
441
+ } ) ;
438
442
this . _initializeEvaluating ( ) ;
439
443
}
440
444
@@ -4465,7 +4469,10 @@ class JavascriptParser extends Parser {
4465
4469
// try compile only if webpack options comment is present
4466
4470
try {
4467
4471
for ( let [ key , val ] of Object . entries (
4468
- vm . runInNewContext ( `(function(){return {${ value } };})()` )
4472
+ vm . runInContext (
4473
+ `(function(){return {${ value } };})()` ,
4474
+ this . magicCommentContext
4475
+ )
4469
4476
) ) {
4470
4477
if ( typeof val === "object" && val !== null ) {
4471
4478
if ( val . constructor . name === "RegExp" ) val = new RegExp ( val ) ;
You can’t perform that action at this time.
0 commit comments