Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid unnecessary facade dependency inlining (#3552)
* implement chunk pruning * remove unused import * seems it can * remove unnecessary phase * remove unused test files * Fix dependencies in facade creation * Respect configured entry order and creates facades from later entries Co-authored-by: Lukas Taegert-Atkinson <lukas.taegert-atkinson@tngtech.com>
- Loading branch information
1 parent
3cbcc8d
commit 07e0b20
Showing
59 changed files
with
371 additions
and
28 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
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,13 @@ | ||
module.exports = { | ||
description: 'alias module dependency inlining', | ||
options: { | ||
input: { | ||
'main1.js': 'main1.js', | ||
'main1-alias.js': 'main1.js', | ||
'main2.js': 'main2.js' | ||
}, | ||
output: { | ||
entryFileNames: '[name]' | ||
} | ||
} | ||
}; |
7 changes: 7 additions & 0 deletions
7
test/chunking-form/samples/entry-aliases/_expected/amd/generated-dep.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 @@ | ||
define(['exports'], function (exports) { 'use strict'; | ||
|
||
var name = 'name'; | ||
|
||
exports.name = name; | ||
|
||
}); |
9 changes: 9 additions & 0 deletions
9
test/chunking-form/samples/entry-aliases/_expected/amd/main1-alias.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,9 @@ | ||
define(['exports', './generated-dep'], function (exports, dep) { 'use strict'; | ||
|
||
|
||
|
||
exports.name = dep.name; | ||
|
||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
|
||
}); |
9 changes: 9 additions & 0 deletions
9
test/chunking-form/samples/entry-aliases/_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,9 @@ | ||
define(['exports', './generated-dep'], function (exports, dep) { 'use strict'; | ||
|
||
|
||
|
||
exports.name = dep.name; | ||
|
||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
|
||
}); |
5 changes: 5 additions & 0 deletions
5
test/chunking-form/samples/entry-aliases/_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-dep'], function (dep) { 'use strict'; | ||
|
||
console.log(dep.name); | ||
|
||
}); |
5 changes: 5 additions & 0 deletions
5
test/chunking-form/samples/entry-aliases/_expected/cjs/generated-dep.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 name = 'name'; | ||
|
||
exports.name = name; |
9 changes: 9 additions & 0 deletions
9
test/chunking-form/samples/entry-aliases/_expected/cjs/main1-alias.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,9 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
|
||
var dep = require('./generated-dep.js'); | ||
|
||
|
||
|
||
exports.name = dep.name; |
9 changes: 9 additions & 0 deletions
9
test/chunking-form/samples/entry-aliases/_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,9 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
|
||
var dep = require('./generated-dep.js'); | ||
|
||
|
||
|
||
exports.name = dep.name; |
5 changes: 5 additions & 0 deletions
5
test/chunking-form/samples/entry-aliases/_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 dep = require('./generated-dep.js'); | ||
|
||
console.log(dep.name); |
3 changes: 3 additions & 0 deletions
3
test/chunking-form/samples/entry-aliases/_expected/es/generated-dep.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 @@ | ||
var name = 'name'; | ||
|
||
export { name as n }; |
1 change: 1 addition & 0 deletions
1
test/chunking-form/samples/entry-aliases/_expected/es/main1-alias.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 { n as name } from './generated-dep.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 { n as name } from './generated-dep.js'; |
3 changes: 3 additions & 0 deletions
3
test/chunking-form/samples/entry-aliases/_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 { n as name } from './generated-dep.js'; | ||
|
||
console.log(name); |
10 changes: 10 additions & 0 deletions
10
test/chunking-form/samples/entry-aliases/_expected/system/generated-dep.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,10 @@ | ||
System.register([], function (exports) { | ||
'use strict'; | ||
return { | ||
execute: function () { | ||
|
||
var name = exports('n', 'name'); | ||
|
||
} | ||
}; | ||
}); |
13 changes: 13 additions & 0 deletions
13
test/chunking-form/samples/entry-aliases/_expected/system/main1-alias.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,13 @@ | ||
System.register(['./generated-dep.js'], function (exports) { | ||
'use strict'; | ||
return { | ||
setters: [function (module) { | ||
exports('name', module.n); | ||
}], | ||
execute: function () { | ||
|
||
|
||
|
||
} | ||
}; | ||
}); |
13 changes: 13 additions & 0 deletions
13
test/chunking-form/samples/entry-aliases/_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,13 @@ | ||
System.register(['./generated-dep.js'], function (exports) { | ||
'use strict'; | ||
return { | ||
setters: [function (module) { | ||
exports('name', module.n); | ||
}], | ||
execute: function () { | ||
|
||
|
||
|
||
} | ||
}; | ||
}); |
14 changes: 14 additions & 0 deletions
14
test/chunking-form/samples/entry-aliases/_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-dep.js'], function () { | ||
'use strict'; | ||
var name; | ||
return { | ||
setters: [function (module) { | ||
name = module.n; | ||
}], | ||
execute: function () { | ||
|
||
console.log(name); | ||
|
||
} | ||
}; | ||
}); |
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 var name = 'name'; |
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 { name } from './dep.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 { name } from './dep.js'; | ||
console.log(name); |
2 changes: 1 addition & 1 deletion
2
test/chunking-form/samples/entry-point-without-own-code/_expected/amd/m1.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
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
1 change: 0 additions & 1 deletion
1
test/chunking-form/samples/entry-point-without-own-code/_expected/es/m1.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 |
---|---|---|
@@ -1,2 +1 @@ | ||
export { default as m2 } from './m2.js'; | ||
import './generated-m1.js'; |
4 changes: 2 additions & 2 deletions
4
test/chunking-form/samples/entry-point-without-own-code/_expected/system/m1.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
10 changes: 10 additions & 0 deletions
10
test/form/samples/prune-pure-unused-import-array/_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,10 @@ | ||
module.exports = { | ||
description: 'prunes pure unused external imports ([#1352])', | ||
options: { | ||
external: ['external', 'other'], | ||
treeshake: { moduleSideEffects: ['other'] }, | ||
output: { | ||
globals: { other: 'other' } | ||
} | ||
} | ||
}; |
5 changes: 5 additions & 0 deletions
5
test/form/samples/prune-pure-unused-import-array/_expected/amd.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(['other'], function (other) { 'use strict'; | ||
|
||
|
||
|
||
}); |
4 changes: 4 additions & 0 deletions
4
test/form/samples/prune-pure-unused-import-array/_expected/cjs.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 @@ | ||
'use strict'; | ||
|
||
require('other'); | ||
|
1 change: 1 addition & 0 deletions
1
test/form/samples/prune-pure-unused-import-array/_expected/es.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 @@ | ||
import 'other'; |
6 changes: 6 additions & 0 deletions
6
test/form/samples/prune-pure-unused-import-array/_expected/iife.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 @@ | ||
(function (other) { | ||
'use strict'; | ||
|
||
|
||
|
||
}(other)); |
11 changes: 11 additions & 0 deletions
11
test/form/samples/prune-pure-unused-import-array/_expected/system.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,11 @@ | ||
System.register(['other'], function () { | ||
'use strict'; | ||
return { | ||
setters: [function () {}], | ||
execute: function () { | ||
|
||
|
||
|
||
} | ||
}; | ||
}); |
9 changes: 9 additions & 0 deletions
9
test/form/samples/prune-pure-unused-import-array/_expected/umd.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,9 @@ | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('other')) : | ||
typeof define === 'function' && define.amd ? define(['other'], factory) : | ||
(global = global || self, factory(global.other)); | ||
}(this, (function (other) { 'use strict'; | ||
|
||
|
||
|
||
}))); |
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 @@ | ||
import { unused } from 'external'; | ||
import { notused } from 'other'; | ||
|
||
function alsoUnused () { | ||
unused(); | ||
notused(); | ||
} |
11 changes: 11 additions & 0 deletions
11
test/form/samples/prune-pure-unused-import-function/_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,11 @@ | ||
module.exports = { | ||
description: 'prunes pure unused external imports ([#1352])', | ||
expectedWarnings: ['EMPTY_BUNDLE'], | ||
options: { | ||
external: ['external', 'other'], | ||
treeshake: { moduleSideEffects: id => id !== 'external' }, | ||
output: { | ||
globals: { other: 'other' } | ||
} | ||
} | ||
}; |
5 changes: 5 additions & 0 deletions
5
test/form/samples/prune-pure-unused-import-function/_expected/amd.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(['other'], function (other) { 'use strict'; | ||
|
||
|
||
|
||
}); |
4 changes: 4 additions & 0 deletions
4
test/form/samples/prune-pure-unused-import-function/_expected/cjs.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 @@ | ||
'use strict'; | ||
|
||
require('other'); | ||
|
1 change: 1 addition & 0 deletions
1
test/form/samples/prune-pure-unused-import-function/_expected/es.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 @@ | ||
import 'other'; |
6 changes: 6 additions & 0 deletions
6
test/form/samples/prune-pure-unused-import-function/_expected/iife.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 @@ | ||
(function (other) { | ||
'use strict'; | ||
|
||
|
||
|
||
}(other)); |
11 changes: 11 additions & 0 deletions
11
test/form/samples/prune-pure-unused-import-function/_expected/system.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,11 @@ | ||
System.register(['other'], function () { | ||
'use strict'; | ||
return { | ||
setters: [function () {}], | ||
execute: function () { | ||
|
||
|
||
|
||
} | ||
}; | ||
}); |
9 changes: 9 additions & 0 deletions
9
test/form/samples/prune-pure-unused-import-function/_expected/umd.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,9 @@ | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('other')) : | ||
typeof define === 'function' && define.amd ? define(['other'], factory) : | ||
(global = global || self, factory(global.other)); | ||
}(this, (function (other) { 'use strict'; | ||
|
||
|
||
|
||
}))); |
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 @@ | ||
import { unused } from 'external'; | ||
import { notused } from 'other'; | ||
|
||
function alsoUnused () { | ||
unused(); | ||
notused(); | ||
} |
Oops, something went wrong.