Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(@angular/cli): add scope hoisting via webpack 3 #6365

Merged
merged 1 commit into from
Jul 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,21 @@
"ember-cli-string-utils": "^1.0.0",
"enhanced-resolve": "^3.1.0",
"exports-loader": "^0.6.3",
"extract-text-webpack-plugin": "^2.1.0",
"extract-text-webpack-plugin": "3.0.0",
"file-loader": "^0.10.0",
"fs-extra": "~3.0.1",
"get-caller-file": "^1.0.0",
"glob": "^7.0.3",
"heimdalljs": "^0.2.4",
"heimdalljs-logger": "^0.1.9",
"html-webpack-plugin": "^2.19.0",
"html-webpack-plugin": "^2.29.0",
"inflection": "^1.7.0",
"inquirer": "^3.0.0",
"isbinaryfile": "^3.0.0",
"istanbul-instrumenter-loader": "^2.0.0",
"json-loader": "^0.5.4",
"less": "^2.7.2",
"less-loader": "^4.0.2",
"less-loader": "^4.0.5",
"license-webpack-plugin": "^0.4.3",
"loader-utils": "^1.0.2",
"lodash": "^4.11.1",
Expand Down Expand Up @@ -97,9 +97,9 @@
"typescript": "~2.3.1",
"url-loader": "^0.5.7",
"walk-sync": "^0.3.1",
"webpack": "~2.4.0",
"webpack-dev-middleware": "^1.10.2",
"webpack-dev-server": "~2.4.5",
"webpack": "~3.1.0",
"webpack-dev-middleware": "^1.11.0",
"webpack-dev-server": "~2.5.1",
"webpack-merge": "^2.4.0",
"zone.js": "^0.8.4"
},
Expand Down
1 change: 1 addition & 0 deletions packages/@angular/cli/models/webpack-configs/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export function getBrowserConfig(wco: WebpackConfigOptions) {
baseHref: buildOptions.baseHref
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'main',
async: 'common',
children: true,
minChunks: 2
Expand Down
2 changes: 2 additions & 0 deletions packages/@angular/cli/models/webpack-configs/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ export function getCommonConfig(wco: WebpackConfigOptions) {
].concat(extraPlugins),
node: {
fs: 'empty',
// `global` should be kept true, removing it resulted in a
// massive size increase with NGO on AIO.
global: true,
crypto: 'empty',
tls: 'empty',
Expand Down
1 change: 1 addition & 0 deletions packages/@angular/cli/models/webpack-configs/production.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export const getProdConfig = function (wco: WebpackConfigOptions) {
'NODE_ENV': 'production'
}),
new webpack.HashedModuleIdsPlugin(),
new webpack.optimize.ModuleConcatenationPlugin(),
new webpack.optimize.UglifyJsPlugin(<any>{
mangle: { screw_ie8: true },
compress: { screw_ie8: true, warnings: buildOptions.verbose },
Expand Down
10 changes: 5 additions & 5 deletions packages/@angular/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,20 @@
"ember-cli-normalize-entity-name": "^1.0.0",
"ember-cli-string-utils": "^1.0.0",
"exports-loader": "^0.6.3",
"extract-text-webpack-plugin": "^2.1.0",
"extract-text-webpack-plugin": "3.0.0",
"file-loader": "^0.10.0",
"fs-extra": "^3.0.1",
"get-caller-file": "^1.0.0",
"glob": "^7.0.3",
"heimdalljs": "^0.2.4",
"heimdalljs-logger": "^0.1.9",
"html-webpack-plugin": "^2.19.0",
"html-webpack-plugin": "^2.29.0",
"inflection": "^1.7.0",
"inquirer": "^3.0.0",
"isbinaryfile": "^3.0.0",
"json-loader": "^0.5.4",
"less": "^2.7.2",
"less-loader": "^4.0.2",
"less-loader": "^4.0.5",
"license-webpack-plugin": "^0.4.2",
"lodash": "^4.11.1",
"memory-fs": "^0.4.1",
Expand Down Expand Up @@ -82,8 +82,8 @@
"typescript": ">=2.0.0 <2.4.0",
"url-loader": "^0.5.7",
"walk-sync": "^0.3.1",
"webpack": "~2.4.0",
"webpack-dev-middleware": "^1.10.2",
"webpack": "~3.1.0",
"webpack-dev-middleware": "^1.11.0",
"webpack-dev-server": "~2.4.5",
"webpack-merge": "^2.4.0",
"zone.js": "^0.8.4"
Expand Down
3 changes: 3 additions & 0 deletions packages/@angular/cli/tasks/eject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ class JsonWebpackSerializer {
case webpack.optimize.UglifyJsPlugin:
this._addImport('webpack.optimize', 'UglifyJsPlugin');
break;
case (webpack.optimize as any).ModuleConcatenationPlugin:
this._addImport('webpack.optimize', 'ModuleConcatenationPlugin');
break;
case angularCliPlugins.BaseHrefWebpackPlugin:
case angularCliPlugins.NamedLazyChunksWebpackPlugin:
case angularCliPlugins.SuppressExtractedTextChunksWebpackPlugin:
Expand Down
5 changes: 5 additions & 0 deletions packages/@angular/cli/webpack-custom-typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@ declare module 'webpack' {
export class HashedModuleIdsPlugin {
constructor();
}
namespace optimize {
export class ModuleConcatenationPlugin {
constructor();
}
}
}
2 changes: 2 additions & 0 deletions scripts/test-licenses.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const licenseReplacements = [
// TODO(hansl): review these
const ignoredPackages = [
'async-foreach@0.1.3', // MIT, but doesn't list it in package.json
'buffer-indexof@1.1.0', // MIT, but doesn't list it in package.json.
'directory-encoder@0.7.2', // MIT, but doesn't list it in package.json
'domelementtype@1.1.3', // Looks like MIT
'domelementtype@1.3.0', // Looks like MIT
Expand All @@ -81,6 +82,7 @@ const ignoredPackages = [
'progress@1.1.8', // MIT, but doesn't list it in package.json
'samsam@1.1.2', // BSD, but doesn't list it in package.json
'stdout-stream@1.4.0', // MIT, but doesn't list it in package.json
'thunky@0.1.0', // MIT, but doesn't list it in package.json.
'uglify-js@2.3.6', // BSD, but doesn't list it in package.json
'undefined@undefined', // Test package with no name nor version.
'verror@1.3.6', // Looks like MIT
Expand Down
12 changes: 6 additions & 6 deletions tests/e2e/tests/build/chunk-hash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ export default function() {
`, '@angular/router'))
.then(() => addImportToModule(
'src/app/app.module.ts', 'ReactiveFormsModule', '@angular/forms'))
.then(() => ng('build', '--prod'))
.then(() => ng('build', '--output-hashing=all'))
.then(() => {
oldHashes = generateFileHashMap();
})
.then(() => ng('build', '--prod'))
.then(() => ng('build', '--output-hashing=all'))
.then(() => {
newHashes = generateFileHashMap();
})
Expand All @@ -74,16 +74,16 @@ export default function() {
oldHashes = newHashes;
})
.then(() => writeFile('src/styles.css', 'body { background: blue; }'))
.then(() => ng('build', '--prod'))
.then(() => ng('build', '--output-hashing=all'))
.then(() => {
newHashes = generateFileHashMap();
})
.then(() => {
validateHashes(oldHashes, newHashes, ['styles']);
validateHashes(oldHashes, newHashes, ['inline', 'styles']);
oldHashes = newHashes;
})
.then(() => writeFile('src/app/app.component.css', 'h1 { margin: 10px; }'))
.then(() => ng('build', '--prod'))
.then(() => ng('build', '--output-hashing=all'))
.then(() => {
newHashes = generateFileHashMap();
})
Expand All @@ -93,7 +93,7 @@ export default function() {
})
.then(() => addImportToModule(
'src/app/lazy/lazy.module.ts', 'ReactiveFormsModule', '@angular/forms'))
.then(() => ng('build', '--prod'))
.then(() => ng('build', '--output-hashing=all'))
.then(() => {
newHashes = generateFileHashMap();
})
Expand Down