diff --git a/src/Bundle.js b/src/Bundle.js index d174b57..4379619 100644 --- a/src/Bundle.js +++ b/src/Bundle.js @@ -323,7 +323,10 @@ export default class Bundle { const exportKeys = keys( module.exports ); return `var ${module.getCanonicalName('*', format === 'es6')} = {\n` + - exportKeys.map( key => `${indentString}get ${key} () { return ${module.getCanonicalName(key, format === 'es6')}; }` ).join( ',\n' ) + + exportKeys.map( key => { + const localName = module.exports[ key ].localName; + return `${indentString}get ${key} () { return ${module.getCanonicalName(localName, format === 'es6')}; }`; + }).join( ',\n' ) + `\n};\n\n`; }).join( '' ); diff --git a/test/function/import-namespace-from-internal-module-renamed/_config.js b/test/function/import-namespace-from-internal-module-renamed/_config.js new file mode 100644 index 0000000..77f908a --- /dev/null +++ b/test/function/import-namespace-from-internal-module-renamed/_config.js @@ -0,0 +1,3 @@ +module.exports = { + description: 'correctly exports x as y inside a bundle' +}; diff --git a/test/function/import-namespace-from-internal-module-renamed/foo.js b/test/function/import-namespace-from-internal-module-renamed/foo.js new file mode 100644 index 0000000..6a9cd7c --- /dev/null +++ b/test/function/import-namespace-from-internal-module-renamed/foo.js @@ -0,0 +1,3 @@ +var x = 42; + +export { x as y }; diff --git a/test/function/import-namespace-from-internal-module-renamed/main.js b/test/function/import-namespace-from-internal-module-renamed/main.js new file mode 100644 index 0000000..12aa3ee --- /dev/null +++ b/test/function/import-namespace-from-internal-module-renamed/main.js @@ -0,0 +1,3 @@ +import * as foo from './foo'; + +assert.equal( foo.y, 42 ); diff --git a/test/function/uses-supplied-ast/_config.js b/test/function/uses-supplied-ast/_config.js index e7c9b00..fff6bd6 100644 --- a/test/function/uses-supplied-ast/_config.js +++ b/test/function/uses-supplied-ast/_config.js @@ -12,7 +12,7 @@ var modules = { sourceType: 'module' }) }, - + 'baz': 'export default 42;' }; @@ -30,6 +30,5 @@ module.exports = { return modules[ id ]; } - }, - solo: true + } };