diff --git a/src/Module.js b/src/Module.js index 35e8a02..f76d7f3 100644 --- a/src/Module.js +++ b/src/Module.js @@ -43,7 +43,7 @@ export default class Module { }); this.statements = ast.body.map( node => { - const magicString = this.magicString.snip( node.start, node.end ); + const magicString = this.magicString.snip( node.start, node.end ).prepend( '\n' ).append( '\n' ); return new Statement( node, magicString, this ); }); } catch ( err ) { diff --git a/src/Statement.js b/src/Statement.js index 042d939..5d8fd24 100644 --- a/src/Statement.js +++ b/src/Statement.js @@ -248,7 +248,7 @@ export default class Statement { } replaceIdentifiers ( names ) { - const magicString = this.magicString.clone().trim(); + const magicString = this.magicString.clone(); const replacementStack = [ names ]; const nameList = keys( names ); diff --git a/src/finalisers/umd.js b/src/finalisers/umd.js index 09164f7..490b60c 100644 --- a/src/finalisers/umd.js +++ b/src/finalisers/umd.js @@ -16,7 +16,7 @@ export default function umd ( bundle, magicString, exportMode, options ) { if ( exportMode === 'named' ) { amdDeps.unshift( `'exports'` ); - cjsDeps.unshift( `'exports'` ); + cjsDeps.unshift( `exports` ); globalDeps.unshift( `(global.${options.moduleName} = {})` ); args.unshift( 'exports' );