@@ -366,11 +366,64 @@ describe.v2('scope hoisting', function () {
366
366
__dirname ,
367
367
'integration/scope-hoisting/es6/re-export-all-fallback-3/entry.js' ,
368
368
) ,
369
+ {
370
+ featureFlags : {
371
+ panicOnEmptyFileImport : false ,
372
+ } ,
373
+ } ,
369
374
) ;
370
375
let output = await run ( b ) ;
371
376
assert . strictEqual ( output , 'FOOBAR!' ) ;
372
377
} ) ;
373
378
379
+ it ( 'produces an invalid bundle when there is an empty file with export *' , async ( ) => {
380
+ await fsFixture ( overlayFS , __dirname ) `
381
+ empty.js:
382
+ // intentionally empty
383
+
384
+ a.js:
385
+ export * from './b.js';
386
+ export * from './c.js';
387
+
388
+ b.js:
389
+ export * from './empty.js';
390
+ export * from './test.js';
391
+
392
+ c.js:
393
+ export * from './empty.js';
394
+
395
+ index.js:
396
+ import {test} from './a.js';
397
+ output(test);
398
+
399
+ package.json:
400
+ {
401
+ "sideEffects": false
402
+ }
403
+
404
+ test.js:
405
+ export const test = 'should not fail';
406
+
407
+ yarn.lock: {}
408
+ ` ;
409
+
410
+ let result = await bundle ( path . join ( __dirname , 'index.js' ) , {
411
+ featureFlags : {
412
+ panicOnEmptyFileImport : false ,
413
+ } ,
414
+ inputFS : overlayFS ,
415
+ } ) ;
416
+
417
+ let output ;
418
+ await run ( result , {
419
+ output ( v ) {
420
+ output = v ;
421
+ } ,
422
+ } ) ;
423
+
424
+ assert . equal ( output , undefined ) ;
425
+ } ) ;
426
+
374
427
it ( 'supports nested re-exporting all when falling back to namespace at runtime' , async function ( ) {
375
428
let b = await bundle (
376
429
path . join (
@@ -390,6 +443,9 @@ describe.v2('scope hoisting', function () {
390
443
'/integration/scope-hoisting/es6/re-export-all-empty-no-side-effects/index.js' ,
391
444
) ,
392
445
{
446
+ featureFlags : {
447
+ panicOnEmptyFileImport : false ,
448
+ } ,
393
449
mode : 'production' ,
394
450
} ,
395
451
) ;
@@ -405,6 +461,25 @@ describe.v2('scope hoisting', function () {
405
461
assert . match ( contents , / o u t p u t = " f o o b a r " / ) ;
406
462
} ) ;
407
463
464
+ it ( 'panics when re-exporting all from an empty module without side effects and panicOnEmptyFileImport is enabled' , async function ( ) {
465
+ await assert . rejects (
466
+ ( ) =>
467
+ bundle (
468
+ path . join (
469
+ __dirname ,
470
+ '/integration/scope-hoisting/es6/re-export-all-empty-no-side-effects/index.js' ,
471
+ ) ,
472
+ {
473
+ mode : 'production' ,
474
+ } ,
475
+ ) ,
476
+ {
477
+ message :
478
+ 'integration/scope-hoisting/es6/re-export-all-empty-no-side-effects/node\\_modules/lib/empty.js must export a value' ,
479
+ } ,
480
+ ) ;
481
+ } ) ;
482
+
408
483
it ( 'supports re-exporting all with ambiguous CJS and non-renaming and renaming dependency retargeting' , async function ( ) {
409
484
let b = await bundle (
410
485
path . join (
@@ -6001,6 +6076,9 @@ describe.v2('scope hoisting', function () {
6001
6076
6002
6077
try {
6003
6078
let b = await bundle ( path . join ( testDir , 'index.html' ) , {
6079
+ featureFlags : {
6080
+ panicOnEmptyFileImport : false ,
6081
+ } ,
6004
6082
inputFS : slowFooFS ,
6005
6083
outputFS : slowFooFS ,
6006
6084
shouldDisableCache : true ,
@@ -6015,6 +6093,9 @@ describe.v2('scope hoisting', function () {
6015
6093
let slowBarFS = new Proxy ( overlayFS , waitHandler ( 'bar.js' , 'foo.js' ) ) ;
6016
6094
6017
6095
let b2 = await bundle ( path . join ( testDir , 'index.html' ) , {
6096
+ featureFlags : {
6097
+ panicOnEmptyFileImport : false ,
6098
+ } ,
6018
6099
inputFS : slowBarFS ,
6019
6100
outputFS : slowBarFS ,
6020
6101
shouldDisableCache : true ,
0 commit comments