Skip to content

Commit

Permalink
Fix SystemJS default variable conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
lukastaegert committed Sep 24, 2020
1 parent 1040292 commit 8284bd3
Show file tree
Hide file tree
Showing 15 changed files with 80 additions and 9 deletions.
4 changes: 1 addition & 3 deletions src/Chunk.ts
Expand Up @@ -994,7 +994,6 @@ export default class Chunk {

private getDependenciesToBeDeconflicted(
addNonNamespacesAndInteropHelpers: boolean,
addInternalDependencies: boolean,
addDependenciesWithoutBindings: boolean,
interop: GetInterop
): DependenciesToBeDeconflicted {
Expand All @@ -1017,7 +1016,7 @@ export default class Chunk {
}
}
}
} else if (addInternalDependencies) {
} else {
const chunk = this.chunkByModule.get(module)!;
if (chunk !== this) {
dependencies.add(chunk);
Expand Down Expand Up @@ -1259,7 +1258,6 @@ export default class Chunk {
this.orderedModules,
this.getDependenciesToBeDeconflicted(
format !== 'es' && format !== 'system',
format !== 'system',
format === 'amd' || format === 'umd' || format === 'iife',
interop
),
Expand Down
@@ -0,0 +1,7 @@
module.exports = {
description: 'deconflicts SystemJS default export variable with namespace imports',
options: {
external: 'external',
output: { preserveModules: true }
}
};
@@ -0,0 +1,7 @@
define(['./other'], function (other) { 'use strict';

var main = other + "extended";

return main;

});
@@ -0,0 +1,9 @@
define(['exports'], function (exports) { 'use strict';

const foo = 'bar';

exports.foo = foo;

Object.defineProperty(exports, '__esModule', { value: true });

});
@@ -0,0 +1,7 @@
'use strict';

var other = require('./other.js');

var main = other + "extended";

module.exports = main;
@@ -0,0 +1,7 @@
'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const foo = 'bar';

exports.foo = foo;
@@ -0,0 +1,5 @@
import * as other from './other.js';

var main = other + "extended";

export default main;
@@ -0,0 +1,3 @@
const foo = 'bar';

export { foo };
@@ -0,0 +1,14 @@
System.register(['./other.js'], function (exports) {
'use strict';
var other;
return {
setters: [function (module) {
other = module;
}],
execute: function () {

var main = exports('default', other + "extended");

}
};
});
@@ -0,0 +1,10 @@
System.register([], function (exports) {
'use strict';
return {
execute: function () {

const foo = exports('foo', 'bar');

}
};
});
@@ -0,0 +1,3 @@
import * as main from './other.js';

export default main + "extended";
@@ -0,0 +1 @@
export const foo = 'bar'
@@ -1,13 +1,13 @@
System.register(['./m1.js'], function () {
'use strict';
var ms;
var m1;
return {
setters: [function (module) {
ms = module;
m1 = module;
}],
execute: function () {

console.log(ms);
console.log(m1);

}
};
Expand Down
@@ -1,13 +1,13 @@
System.register(['./m1.js'], function () {
'use strict';
var ms;
var m1;
return {
setters: [function (module) {
ms = module;
m1 = module;
}],
execute: function () {

console.log(ms);
console.log(m1);

}
};
Expand Down
Empty file.

0 comments on commit 8284bd3

Please sign in to comment.