Browse Source

alternative fix for #270

better-aggressive
Rich Harris 9 years ago
parent
commit
dc564da15a
  1. 2
      src/Module.js
  2. 3
      src/Statement.js
  3. 5
      test/function/export-from-no-local-binding-var/_config.js

2
src/Module.js

@ -344,7 +344,7 @@ export default class Module {
if ( declaration ) {
declaration.addReference( reference );
} else if ( statement.node.type !== 'ExportNamedDeclaration' || !this.reexports[ reference.name ] ) {
} else {
// TODO handle globals
this.bundle.assumedGlobals[ reference.name ] = true;
}

3
src/Statement.js

@ -100,6 +100,9 @@ export default class Statement {
module.bundle.onwarn( `Use of \`eval\` (in ${module.id}) is discouraged, as it may cause issues with minification. See https://github.com/rollup/rollup/wiki/Troubleshooting#avoiding-eval for more details` );
}
// skip re-export declarations
if ( node.type === 'ExportNamedDeclaration' && node.source ) return this.skip();
if ( node.type === 'TemplateElement' ) stringLiteralRanges.push([ node.start, node.end ]);
if ( node.type === 'Literal' && typeof node.value === 'string' && /\n/.test( node.raw ) ) {
stringLiteralRanges.push([ node.start + 1, node.end - 1 ]);

5
test/function/export-from-no-local-binding-var/_config.js

@ -1,5 +1,8 @@
var assert = require( 'assert' );
module.exports = {
description: 'export from does not create a local binding'
description: 'export from does not create a local binding',
runtimeError: function ( err ) {
assert.ok( /foo is not defined/.test( err.message ) );
}
};

Loading…
Cancel
Save