Browse Source

fix export * from external bug

semi-dynamic-namespace-imports
Rich-Harris 8 years ago
parent
commit
1e98a69e2e
  1. 2
      src/Bundle.js
  2. 6
      test/function/export-all-from-external/_config.js
  3. 4
      test/function/export-all-from-external/main.js
  4. 5
      test/function/export-all-from-external/path-plus.js

2
src/Bundle.js

@ -216,6 +216,8 @@ export default class Bundle {
module.exportAllSources.forEach( source => {
const id = module.resolvedIds[ source ];
const exportAllModule = this.moduleById.get( id );
if ( exportAllModule.isExternal ) return;
keys( exportAllModule.exportsAll ).forEach( name => {
if ( name in module.exportsAll ) {
this.onwarn( `Conflicting namespaces: ${module.id} re-exports '${name}' from both ${module.exportsAll[ name ]} (will be ignored) and ${exportAllModule.exportsAll[ name ]}.` );

6
test/function/export-all-from-external/_config.js

@ -0,0 +1,6 @@
module.exports = {
description: 'allows `export *` from external module, internally',
options: {
external: [ 'path' ]
}
};

4
test/function/export-all-from-external/main.js

@ -0,0 +1,4 @@
import { dirname, isRelative } from './path-plus.js';
assert.equal( dirname( 'foo/bar' ), 'foo' );
assert.ok( isRelative( './foo' ) );

5
test/function/export-all-from-external/path-plus.js

@ -0,0 +1,5 @@
export * from 'path';
export function isRelative ( path ) {
return path[0] === '.';
}
Loading…
Cancel
Save