Skip to content

Commit

Permalink
Merge pull request #1218 from rollup/export-default-no-space
Browse files Browse the repository at this point in the history
handle export default{}
  • Loading branch information
Rich-Harris committed Jan 4, 2017
2 parents 5dfae02 + e7fa75c commit 7af9387
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ast/nodes/ExportDefaultDeclaration.js
Expand Up @@ -53,7 +53,7 @@ export default class ExportDefaultDeclaration extends Node {
let declaration_start;
if ( this.declaration ) {
const statementStr = code.original.slice( this.start, this.end );
declaration_start = this.start + statementStr.match(/^\s*export\s+default\s+/)[0].length;
declaration_start = this.start + statementStr.match(/^\s*export\s+default\s*/)[0].length;
}

if ( this.shouldInclude || this.declaration.activated ) {
Expand Down
8 changes: 8 additions & 0 deletions test/function/export-default-no-space/_config.js
@@ -0,0 +1,8 @@
const assert = require( 'assert' );

module.exports = {
description: 'handles default exports with no space before declaration',
exports: exports => {
assert.deepEqual( exports, {} );
}
};
1 change: 1 addition & 0 deletions test/function/export-default-no-space/main.js
@@ -0,0 +1 @@
export default{};

0 comments on commit 7af9387

Please sign in to comment.