Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deduplicate imports referencing default exports and their original va…
…riables (#2719) * Deduplicate imports referencing default exports and their original variables * Update changelog
- Loading branch information
1 parent
5d6e01c
commit 297cc8c
Showing
20 changed files
with
133 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
test/chunking-form/samples/deduplicate-imports-referencing-originals/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
description: | ||
'do not import variables that reference an original if the original is already imported', | ||
options: { | ||
input: ['main1', 'main2'] | ||
} | ||
}; |
8 changes: 8 additions & 0 deletions
8
...g-form/samples/deduplicate-imports-referencing-originals/_expected/amd/generated-chunk.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
define(['exports'], function (exports) { 'use strict'; | ||
|
||
const foo = {}; | ||
|
||
exports.foo = foo; | ||
exports.bar = foo; | ||
|
||
}); |
5 changes: 5 additions & 0 deletions
5
test/chunking-form/samples/deduplicate-imports-referencing-originals/_expected/amd/main1.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
define(['./generated-chunk.js'], function (__chunk_1) { 'use strict'; | ||
|
||
console.log(__chunk_1.bar, __chunk_1.bar); | ||
|
||
}); |
5 changes: 5 additions & 0 deletions
5
test/chunking-form/samples/deduplicate-imports-referencing-originals/_expected/amd/main2.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
define(['./generated-chunk.js'], function (__chunk_1) { 'use strict'; | ||
|
||
console.log(__chunk_1.bar, __chunk_1.bar); | ||
|
||
}); |
6 changes: 6 additions & 0 deletions
6
...g-form/samples/deduplicate-imports-referencing-originals/_expected/cjs/generated-chunk.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
'use strict'; | ||
|
||
const foo = {}; | ||
|
||
exports.foo = foo; | ||
exports.bar = foo; |
5 changes: 5 additions & 0 deletions
5
test/chunking-form/samples/deduplicate-imports-referencing-originals/_expected/cjs/main1.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use strict'; | ||
|
||
var __chunk_1 = require('./generated-chunk.js'); | ||
|
||
console.log(__chunk_1.bar, __chunk_1.bar); |
5 changes: 5 additions & 0 deletions
5
test/chunking-form/samples/deduplicate-imports-referencing-originals/_expected/cjs/main2.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use strict'; | ||
|
||
var __chunk_1 = require('./generated-chunk.js'); | ||
|
||
console.log(__chunk_1.bar, __chunk_1.bar); |
3 changes: 3 additions & 0 deletions
3
...ng-form/samples/deduplicate-imports-referencing-originals/_expected/es/generated-chunk.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const foo = {}; | ||
|
||
export { foo as a, foo as b }; |
3 changes: 3 additions & 0 deletions
3
test/chunking-form/samples/deduplicate-imports-referencing-originals/_expected/es/main1.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { a as bar } from './generated-chunk.js'; | ||
|
||
console.log(bar, bar); |
3 changes: 3 additions & 0 deletions
3
test/chunking-form/samples/deduplicate-imports-referencing-originals/_expected/es/main2.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { a as bar } from './generated-chunk.js'; | ||
|
||
console.log(bar, bar); |
12 changes: 12 additions & 0 deletions
12
...orm/samples/deduplicate-imports-referencing-originals/_expected/system/generated-chunk.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
System.register([], function (exports, module) { | ||
'use strict'; | ||
return { | ||
execute: function () { | ||
|
||
const foo = exports('a', {}); | ||
|
||
exports('b', foo); | ||
|
||
} | ||
}; | ||
}); |
14 changes: 14 additions & 0 deletions
14
...chunking-form/samples/deduplicate-imports-referencing-originals/_expected/system/main1.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
System.register(['./generated-chunk.js'], function (exports, module) { | ||
'use strict'; | ||
var bar; | ||
return { | ||
setters: [function (module) { | ||
bar = module.a; | ||
}], | ||
execute: function () { | ||
|
||
console.log(bar, bar); | ||
|
||
} | ||
}; | ||
}); |
14 changes: 14 additions & 0 deletions
14
...chunking-form/samples/deduplicate-imports-referencing-originals/_expected/system/main2.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
System.register(['./generated-chunk.js'], function (exports, module) { | ||
'use strict'; | ||
var bar; | ||
return { | ||
setters: [function (module) { | ||
bar = module.a; | ||
}], | ||
execute: function () { | ||
|
||
console.log(bar, bar); | ||
|
||
} | ||
}; | ||
}); |
1 change: 1 addition & 0 deletions
1
test/chunking-form/samples/deduplicate-imports-referencing-originals/foo.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const foo = {}; |
4 changes: 4 additions & 0 deletions
4
test/chunking-form/samples/deduplicate-imports-referencing-originals/main1.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { foo } from './foo'; | ||
import bar from './proxy'; | ||
|
||
console.log(foo, bar); |
4 changes: 4 additions & 0 deletions
4
test/chunking-form/samples/deduplicate-imports-referencing-originals/main2.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { foo } from './foo'; | ||
import bar from './proxy'; | ||
|
||
console.log(foo, bar); |
2 changes: 2 additions & 0 deletions
2
test/chunking-form/samples/deduplicate-imports-referencing-originals/proxy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import { foo } from './foo'; | ||
export default foo; |