@@ -23,7 +23,7 @@ import {
23
23
ClassDeclaration ,
24
24
} from 'estree' ;
25
25
import { TransformSourceDescription , OutputChunk } from 'rollup' ;
26
- import { NamedDeclaration , DefaultDeclaration , defaultUnamedExportName } from './parsing-utilities' ;
26
+ import { NamedDeclaration , DefaultDeclaration } from './parsing-utilities' ;
27
27
import { isESMFormat } from '../options' ;
28
28
import {
29
29
ExportNameToClosureMapping ,
@@ -84,36 +84,6 @@ export default class ExportTransform extends Transform implements TransformInter
84
84
return void 0 ;
85
85
}
86
86
87
- /**
88
- * Rollup's naming scheme for default exports can sometimes clash with reserved
89
- * words.
90
- *
91
- * Rollup protects output by renaming the values with it's own algorithm, so we need to
92
- * ensure that when it changes the name of a default export this transform is aware of its
93
- * new name in the output.
94
- *
95
- * i.e. default class {} => window._class = class {} => default class {}.
96
- * @param chunk OutputChunk from Rollup for this code.
97
- * @param id Rollup id reference to the source
98
- */
99
- private repairExportMapping ( chunk : any , id : string ) : void {
100
- const defaultExportName = defaultUnamedExportName ( id ) ;
101
- if (
102
- chunk . exportNames &&
103
- chunk . exportNames . default &&
104
- chunk . exportNames . default . safeName &&
105
- defaultExportName !== chunk . exportNames . default . safeName &&
106
- this . originalExports [ defaultExportName ]
107
- ) {
108
- // If there was a detected default export, we need to ensure Rollup
109
- // did not rename the export.
110
- this . originalExports [ chunk . exportNames . default . safeName ] = this . originalExports [
111
- defaultExportName
112
- ] ;
113
- delete this . originalExports [ defaultExportName ] ;
114
- }
115
- }
116
-
117
87
/**
118
88
* Before Closure Compiler modifies the source, we need to ensure it has window scoped
119
89
* references to the named exports. This prevents Closure from mangling their names.
@@ -132,8 +102,6 @@ export default class ExportTransform extends Transform implements TransformInter
132
102
'Rollup Plugin Closure Compiler, OutputOptions not known before Closure Compiler invocation.' ,
133
103
) ;
134
104
} else if ( isESMFormat ( this . outputOptions . format ) ) {
135
- this . repairExportMapping ( chunk , id ) ;
136
-
137
105
const source = new MagicString ( code ) ;
138
106
// Window scoped references for each key are required to ensure Closure Compilre retains the code.
139
107
Object . keys ( this . originalExports ) . forEach ( key => {
0 commit comments