Skip to content

Commit

Permalink
Merge pull request #859 from rollup/gh-846
Browse files Browse the repository at this point in the history
fix noConflict when used via config file
  • Loading branch information
Rich-Harris committed Aug 17, 2016
2 parents de37d47 + 3ed945c commit fa46419
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 4 deletions.
5 changes: 1 addition & 4 deletions bin/src/runRollup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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 ) ) {
Expand Down
4 changes: 4 additions & 0 deletions test/cli/no-conflict/_config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
description: 'respects noConflict option',
command: 'rollup --config rollup.config.js'
};
16 changes: 16 additions & 0 deletions test/cli/no-conflict/_expected.js
Original file line number Diff line number Diff line change
@@ -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;

})));
1 change: 1 addition & 0 deletions test/cli/no-conflict/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {};
6 changes: 6 additions & 0 deletions test/cli/no-conflict/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
entry: 'main.js',
format: 'umd',
moduleName: 'conflictyName',
noConflict: true
};

0 comments on commit fa46419

Please sign in to comment.