diff --git a/src/ast/nodes/ExportDefaultDeclaration.js b/src/ast/nodes/ExportDefaultDeclaration.js index 7027291..2f505b1 100644 --- a/src/ast/nodes/ExportDefaultDeclaration.js +++ b/src/ast/nodes/ExportDefaultDeclaration.js @@ -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 ) { diff --git a/test/function/export-default-no-space/_config.js b/test/function/export-default-no-space/_config.js new file mode 100644 index 0000000..8a27d49 --- /dev/null +++ b/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, {} ); + } +}; diff --git a/test/function/export-default-no-space/main.js b/test/function/export-default-no-space/main.js new file mode 100644 index 0000000..f9749a6 --- /dev/null +++ b/test/function/export-default-no-space/main.js @@ -0,0 +1 @@ +export default{};