Browse Source

make external modules configurable

better-aggressive
Rich Harris 9 years ago
parent
commit
fd3ae38c18
  1. 2
      src/Statement.js
  2. 11
      test/function/configure-external-module-b/_config.js
  3. 3
      test/function/configure-external-module-b/main.js
  4. 11
      test/function/configure-external-module/_config.js
  5. 3
      test/function/configure-external-module/main.js

2
src/Statement.js

@ -195,7 +195,7 @@ export default class Statement {
const declaration = statement.module.trace( subject.name );
if ( !declaration || declaration.statement.isIncluded ) {
if ( !declaration || declaration.isExternal || declaration.statement.isIncluded ) {
hasSideEffect = true;
}
}

11
test/function/configure-external-module-b/_config.js

@ -0,0 +1,11 @@
var assert = require( 'assert' );
module.exports = {
description: 'allows external module to be configured (b)',
options: {
external: [ 'path' ]
},
exports: function () {
assert.equal( require( 'path' ).resolve.configured, 'yes' );
}
};

3
test/function/configure-external-module-b/main.js

@ -0,0 +1,3 @@
import { resolve } from 'path';
resolve.configured = 'yes';

11
test/function/configure-external-module/_config.js

@ -0,0 +1,11 @@
var assert = require( 'assert' );
module.exports = {
description: 'allows external module to be configured',
options: {
external: [ 'path' ]
},
exports: function () {
assert.equal( require( 'path' ).resolve.configured, 'yes' );
}
};

3
test/function/configure-external-module/main.js

@ -0,0 +1,3 @@
import * as path from 'path';
path.resolve.configured = 'yes';
Loading…
Cancel
Save