diff --git a/bin/src/runRollup.js b/bin/src/runRollup.js index cbfa064..270654f 100644 --- a/bin/src/runRollup.js +++ b/bin/src/runRollup.js @@ -70,7 +70,7 @@ export default function runRollup ( command ) { }); // temporarily override require - var defaultLoader = require.extensions[ '.js' ]; + const defaultLoader = require.extensions[ '.js' ]; require.extensions[ '.js' ] = ( m, filename ) => { if ( filename === config ) { m._compile( code, filename ); @@ -147,9 +147,6 @@ function execute ( options, command ) { options.external = external; - options.noConflict = command.conflict === false; - delete command.conflict; - // Use any options passed through the CLI as overrides. Object.keys( equivalents ).forEach( cliOption => { if ( command.hasOwnProperty( cliOption ) ) { diff --git a/test/cli/no-conflict/_config.js b/test/cli/no-conflict/_config.js new file mode 100644 index 0000000..cc870f8 --- /dev/null +++ b/test/cli/no-conflict/_config.js @@ -0,0 +1,4 @@ +module.exports = { + description: 'respects noConflict option', + command: 'rollup --config rollup.config.js' +}; diff --git a/test/cli/no-conflict/_expected.js b/test/cli/no-conflict/_expected.js new file mode 100644 index 0000000..1b363c9 --- /dev/null +++ b/test/cli/no-conflict/_expected.js @@ -0,0 +1,16 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (function() { + var current = global.conflictyName; + var exports = factory(); + global.conflictyName = exports; + exports.noConflict = function() { global.conflictyName = current; return exports; }; + })(); +}(this, (function () { 'use strict'; + +var main = {}; + +return main; + +}))); diff --git a/test/cli/no-conflict/main.js b/test/cli/no-conflict/main.js new file mode 100644 index 0000000..ff8b4c5 --- /dev/null +++ b/test/cli/no-conflict/main.js @@ -0,0 +1 @@ +export default {}; diff --git a/test/cli/no-conflict/rollup.config.js b/test/cli/no-conflict/rollup.config.js new file mode 100644 index 0000000..a1b8d7d --- /dev/null +++ b/test/cli/no-conflict/rollup.config.js @@ -0,0 +1,6 @@ +module.exports = { + entry: 'main.js', + format: 'umd', + moduleName: 'conflictyName', + noConflict: true +};