File tree Expand file tree Collapse file tree
test/chunking-form/samples/deoptimized-module-with-dynamic-import Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -425,7 +425,11 @@ function getDynamicallyDependentEntriesByDynamicEntry(
425425 getDynamicImporters ( dynamicEntry ) ,
426426 dynamicEntry . implicitlyLoadedAfter
427427 ] ) ) {
428- for ( const entry of dependentEntriesByModule . get ( importer ) ! ) {
428+ const importerEntries = dependentEntriesByModule . get ( importer ) ;
429+ if ( ! importerEntries ) {
430+ continue ;
431+ }
432+ for ( const entry of importerEntries ) {
429433 dynamicallyDependentEntries . add ( entry ) ;
430434 }
431435 }
Original file line number Diff line number Diff line change 1+ const path = require ( 'node:path' ) ;
2+
3+ module . exports = defineTest ( {
4+ description : 'deoptimized module with dynamic import' ,
5+ options : {
6+ plugins : [
7+ {
8+ resolveId ( id ) {
9+ if ( id === './lazy-loader.js' ) {
10+ return {
11+ id : path . resolve ( './lazy-loader.js' ) ,
12+ moduleSideEffects : false
13+ } ;
14+ }
15+ }
16+ }
17+ ]
18+ }
19+ } ) ;
Original file line number Diff line number Diff line change 1+ define ( [ 'exports' ] , ( function ( exports ) { 'use strict' ;
2+
3+ const value = 42 ;
4+
5+ console . log ( value ) ;
6+
7+ var cjs = /*#__PURE__*/ Object . freeze ( {
8+ __proto__ : null
9+ } ) ;
10+
11+ exports . cjs = cjs ;
12+
13+ } ) ) ;
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
3+ const value = 42 ;
4+
5+ console . log ( value ) ;
6+
7+ var cjs = /*#__PURE__*/ Object . freeze ( {
8+ __proto__ : null
9+ } ) ;
10+
11+ exports . cjs = cjs ;
Original file line number Diff line number Diff line change 1+ const value = 42 ;
2+
3+ console . log ( value ) ;
4+
5+ var cjs = /*#__PURE__*/ Object . freeze ( {
6+ __proto__ : null
7+ } ) ;
8+
9+ export { cjs as c } ;
Original file line number Diff line number Diff line change 1+ System . register ( [ ] , ( function ( exports ) {
2+ 'use strict' ;
3+ return {
4+ execute : ( function ( ) {
5+
6+ const value = 42 ;
7+
8+ console . log ( value ) ;
9+
10+ var cjs = /*#__PURE__*/ Object . freeze ( {
11+ __proto__ : null
12+ } ) ;
13+ exports ( "c" , cjs ) ;
14+
15+ } )
16+ } ;
17+ } ) ) ;
Original file line number Diff line number Diff line change 1+ import { fn } from './lazy-loader.js' ;
2+
3+ const x = fn ;
4+
5+ function loadCjs ( ) {
6+ return import ( './cjs.js' ) ;
7+ }
8+
9+ export const value = 42 ;
Original file line number Diff line number Diff line change 1+ export const cjs = 'cjs-value' ;
Original file line number Diff line number Diff line change 1+ export function fn ( ) { }
2+
3+ import ( './cjs.js' ) ;
Original file line number Diff line number Diff line change 1+ import { value } from './a.js' ;
2+ console . log ( value ) ;
You can’t perform that action at this time.
0 commit comments