Browse Source

Merge pull request #58 from rollup/Fix-#57

Fix #57
contingency-plan
Rich Harris 10 years ago
parent
commit
baa2eefad8
  1. 2
      src/finalisers/umd.js
  2. 6
      test/form/external-imports/_config.js
  3. 5
      test/form/external-imports/_expected/amd.js
  4. 6
      test/form/external-imports/_expected/cjs.js
  5. 1
      test/form/external-imports/_expected/es6.js
  6. 5
      test/form/external-imports/_expected/iife.js
  7. 9
      test/form/external-imports/_expected/umd.js
  8. 2
      test/form/external-imports/main.js

2
src/finalisers/umd.js

@ -11,7 +11,7 @@ export default function umd ( bundle, magicString, { exportMode, indentString },
let amdDeps = bundle.externalModules.map( quoteId );
let cjsDeps = bundle.externalModules.map( req );
let globalDeps = bundle.externalModules.map( module => {
return globalNames[ module.id ] || module.name;
return 'global.' + (globalNames[ module.id ] || module.name);
});
let args = bundle.externalModules.map( getName );

6
test/form/external-imports/_config.js

@ -0,0 +1,6 @@
module.exports = {
description: 'prefixes global names with `global.` when creating UMD bundle (#57)',
options: {
external: [ 'factory' ]
}
};

5
test/form/external-imports/_expected/amd.js

@ -0,0 +1,5 @@
define(['factory'], function (factory) { 'use strict';
factory( null );
});

6
test/form/external-imports/_expected/cjs.js

@ -0,0 +1,6 @@
'use strict';
var factory = require('factory');
factory = 'default' in factory ? factory['default'] : factory;
factory( null );

1
test/form/external-imports/_expected/es6.js

@ -0,0 +1 @@
factory( null );

5
test/form/external-imports/_expected/iife.js

@ -0,0 +1,5 @@
(function (factory) { 'use strict';
factory( null );
})(factory);

9
test/form/external-imports/_expected/umd.js

@ -0,0 +1,9 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('factory')) :
typeof define === 'function' && define.amd ? define(['factory'], factory) :
factory(global.factory);
}(this, function (factory) { 'use strict';
factory( null );
}));

2
test/form/external-imports/main.js

@ -0,0 +1,2 @@
import factory from 'factory';
factory( null );
Loading…
Cancel
Save