File tree Expand file tree Collapse file tree 4 files changed +26
-10194
lines changed Expand file tree Collapse file tree 4 files changed +26
-10194
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,13 @@ export default defineConfig({
88 path . join ( path . dirname ( testPath ) , '.snapshots' , path . basename ( testPath ) + snapExt )
99 } ,
1010 resolve : {
11- // Allow importing the current package under test via `~package`
12- alias : [ { find : / ^ ~ p a c k a g e $ / , replacement : path . resolve ( process . cwd ( ) ) } ]
11+ // Allow importing the current package under test via `~package`.
12+ // Point directly at the built entry so dynamic imports in tests work consistently.
13+ alias : [
14+ {
15+ find : / ^ ~ p a c k a g e $ / ,
16+ replacement : path . resolve ( process . cwd ( ) , 'dist/index.js' )
17+ }
18+ ]
1319 }
1420} ) ;
Original file line number Diff line number Diff line change @@ -58,7 +58,15 @@ export default function autoInstall(opts: RollupAutoInstallOptions = {}): Plugin
5858 pkg = { } ;
5959 }
6060
61- const installed = new Set ( Object . keys ( pkg . dependencies || { } ) . concat ( builtinModules ) ) ;
61+ // Normalize core module names to include both `fs` and `node:fs` forms so we never try to
62+ // install built-ins regardless of how Rollup reports them or how they are imported.
63+ const coreModules = new Set < string > ( [
64+ ...builtinModules ,
65+ ...builtinModules . filter ( ( m ) => m . startsWith ( 'node:' ) ) . map ( ( m ) => m . slice ( 5 ) ) ,
66+ ...builtinModules . filter ( ( m ) => ! m . startsWith ( 'node:' ) ) . map ( ( m ) => `node:${ m } ` )
67+ ] ) ;
68+
69+ const installed = new Set ( [ ...Object . keys ( pkg . dependencies || { } ) , ...coreModules ] ) ;
6270 const cmd = commands [ manager ] ;
6371
6472 return {
Original file line number Diff line number Diff line change 1+
You can’t perform that action at this time.
0 commit comments