Browse Source

handle parenthesised default exports (#136)

better-aggressive
Rich Harris 9 years ago
parent
commit
940daa4f5b
  1. 3
      src/Module.js
  2. 3
      test/function/parenthesised-default-export/_config.js
  3. 1
      test/function/parenthesised-default-export/main.js

3
src/Module.js

@ -495,7 +495,8 @@ export default class Module {
ast = parse( this.source, { ast = parse( this.source, {
ecmaVersion: 6, ecmaVersion: 6,
sourceType: 'module', sourceType: 'module',
onComment: ( block, text, start, end ) => this.comments.push({ block, text, start, end }) onComment: ( block, text, start, end ) => this.comments.push({ block, text, start, end }),
preserveParens: true
}); });
} catch ( err ) { } catch ( err ) {
err.code = 'PARSE_ERROR'; err.code = 'PARSE_ERROR';

3
test/function/parenthesised-default-export/_config.js

@ -0,0 +1,3 @@
module.exports = {
description: 'allows default exports to be enclosed in parentheses'
};

1
test/function/parenthesised-default-export/main.js

@ -0,0 +1 @@
export default ( 42 );
Loading…
Cancel
Save