diff --git a/src/utils/run.js b/src/utils/run.js index 3e91d63..23b0493 100644 --- a/src/utils/run.js +++ b/src/utils/run.js @@ -104,7 +104,7 @@ export default function run ( node, scope, statement, strongDependencies, force } else { declaration = statement.module.trace( subject.name ); - if ( !declaration || declaration.isExternal || declaration.isUsed ) { + if ( !declaration || declaration.isExternal || declaration.isUsed || ( declaration.original && declaration.original.isUsed ) ) { hasSideEffect = true; } } diff --git a/test/function/export-two-ways-default/bar.js b/test/function/export-two-ways-default/bar.js index 77de92f..73801a6 100644 --- a/test/function/export-two-ways-default/bar.js +++ b/test/function/export-two-ways-default/bar.js @@ -1,6 +1,6 @@ import { X } from './x.js'; // import X works X.prototype.bar = function () { - console.log( 'bar' ); + this.didBar = true; return this; }; diff --git a/test/function/export-two-ways-default/foo.js b/test/function/export-two-ways-default/foo.js index d31091b..5b9b01e 100644 --- a/test/function/export-two-ways-default/foo.js +++ b/test/function/export-two-ways-default/foo.js @@ -1,7 +1,7 @@ export function X () {} X.prototype.foo = function () { - console.log( 'foo' ); + this.didFoo = true; return this; }; diff --git a/test/function/export-two-ways-default/main.js b/test/function/export-two-ways-default/main.js index 792e5a4..9b7c1d7 100644 --- a/test/function/export-two-ways-default/main.js +++ b/test/function/export-two-ways-default/main.js @@ -1,4 +1,6 @@ import { x } from './x.js'; import './bar.js'; -x().foo().bar(); +var result = x().foo().bar(); +assert.ok( result.didFoo ); +assert.ok( result.didBar );