File tree Expand file tree Collapse file tree 3 files changed +7
-2
lines changed
packages/app/src/sandbox/eval Expand file tree Collapse file tree 3 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -5,4 +5,6 @@ export type Module = {
55 code : string ,
66 requires ?: Array < string > ,
77 downloaded ?: boolean ,
8+ /** Whether the module was created as stub for the "browsers" package field */
9+ stubbed ?: boolean ,
810} ;
Original file line number Diff line number Diff line change @@ -334,6 +334,7 @@ export default async function fetchModule(
334334 : pathUtils . join ( currentPath , path ) ,
335335 code : 'module . exports = { } ; ',
336336 requires : [ ] ,
337+ stubbed : true ,
337338 } ;
338339 }
339340
Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ import type { WarningStructure } from './transpilers/utils/worker-warning-handle
1717
1818import resolveDependency from './loaders/dependency-resolver' ;
1919import evaluate from './loaders/eval' ;
20- import isESModule from './utils/is-es-module' ;
2120
2221import type { default as Manager } from './manager' ;
2322import HMR from './hmr' ;
@@ -977,7 +976,10 @@ export default class TranspiledModule {
977976 this . initiators . size === 0 &&
978977 this . transpilationInitiators . size === 0 &&
979978 ! this . isEntry &&
980- ! manager . isFirstLoad
979+ ! manager . isFirstLoad &&
980+ // Don't delete stubbed modules, they are here for a reason, most probably
981+ // because they are aliased with a browser field
982+ ! this . module . stubbed
981983 ) {
982984 // Remove the module from the transpiler if it's not used anymore
983985 debug ( `Removing '${ this . getId ( ) } ' from manager.` ) ;
You can’t perform that action at this time.
0 commit comments