File tree Expand file tree Collapse file tree 2 files changed +10
-34
lines changed
repo-scripts/size-analysis
bundle-definition-examples Expand file tree Collapse file tree 2 files changed +10
-34
lines changed Original file line number Diff line number Diff line change @@ -432,22 +432,18 @@ function createImportExport(
432
432
const contentArray = [ ] ;
433
433
434
434
switch ( symbol ) {
435
- case SpecialImport . Default :
436
- contentArray . push (
437
- `import ${ createSymbolName (
438
- 'default_import' ,
439
- symbolsCache
440
- ) } from '${ modulePath } ';`
441
- ) ;
435
+ case SpecialImport . Default : {
436
+ const nameToUse = createSymbolName ( 'default_import' , symbolsCache ) ;
437
+ contentArray . push ( `import ${ nameToUse } from '${ modulePath } ';` ) ;
438
+ contentArray . push ( `console.log(${ nameToUse } )` ) ; // prevent import from being tree shaken
442
439
break ;
443
- case SpecialImport . Namespace :
444
- contentArray . push (
445
- `import * as ${ createSymbolName (
446
- 'namespace' ,
447
- symbolsCache
448
- ) } from '${ modulePath } ';`
449
- ) ;
440
+ }
441
+ case SpecialImport . Namespace : {
442
+ const nameToUse = createSymbolName ( 'namespace' , symbolsCache ) ;
443
+ contentArray . push ( `import * as ${ nameToUse } from '${ modulePath } ';` ) ;
444
+ contentArray . push ( `console.log(${ nameToUse } )` ) ; // prevent import from being tree shaken
450
445
break ;
446
+ }
451
447
case SpecialImport . Sizeeffect :
452
448
contentArray . push ( `import '${ modulePath } ';` ) ;
453
449
break ;
Original file line number Diff line number Diff line change 40
40
]
41
41
}
42
42
]
43
- },
44
- {
45
- "name" : " test3" ,
46
- "description" : " symbols with the same name" ,
47
- "dependencies" : [
48
- {
49
- "packageName" : " @firebase/firestore" ,
50
- "versionOrTag" : " exp" ,
51
- "imports" : [
52
- " ref"
53
- ]
54
- },
55
- {
56
- "packageName" : " @firebase/storage" ,
57
- "versionOrTag" : " exp" ,
58
- "imports" : [
59
- " ref"
60
- ]
61
- }
62
- ]
63
43
}
64
44
]
You can’t perform that action at this time.
0 commit comments