@@ -18,10 +18,6 @@ const webpack_sources_1 = require("webpack-sources");
18
18
const utils_1 = require ( "../../../utils" ) ;
19
19
const cache_path_1 = require ( "../../../utils/cache-path" ) ;
20
20
const environment_options_1 = require ( "../../../utils/environment-options" ) ;
21
- const bundle_budget_1 = require ( "../../plugins/bundle-budget" ) ;
22
- const named_chunks_plugin_1 = require ( "../../plugins/named-chunks-plugin" ) ;
23
- const optimize_css_webpack_plugin_1 = require ( "../../plugins/optimize-css-webpack-plugin" ) ;
24
- const scripts_webpack_plugin_1 = require ( "../../plugins/scripts-webpack-plugin" ) ;
25
21
const webpack_2 = require ( "../../plugins/webpack" ) ;
26
22
const find_up_1 = require ( "../../utilities/find-up" ) ;
27
23
const utils_2 = require ( "./utils" ) ;
@@ -172,7 +168,7 @@ function getCommonConfig(wco) {
172
168
// Lazy scripts don't get a hash, otherwise they can't be loaded by name.
173
169
const hash = script . inject ? hashFormat . script : '' ;
174
170
const bundleName = script . bundleName ;
175
- extraPlugins . push ( new scripts_webpack_plugin_1 . ScriptsWebpackPlugin ( {
171
+ extraPlugins . push ( new webpack_2 . ScriptsWebpackPlugin ( {
176
172
name : bundleName ,
177
173
sourceMap : scriptsSourceMap ,
178
174
filename : `${ path . basename ( bundleName ) } ${ hash } .js` ,
@@ -226,7 +222,12 @@ function getCommonConfig(wco) {
226
222
} ) ( ) ) ;
227
223
}
228
224
if ( buildOptions . namedChunks ) {
229
- extraPlugins . push ( new named_chunks_plugin_1 . NamedLazyChunksPlugin ( ) ) ;
225
+ extraPlugins . push ( new webpack_2 . NamedLazyChunksPlugin ( ) ) ;
226
+ }
227
+ if ( ! differentialLoadingMode ) {
228
+ // Budgets are computed after differential builds, not via a plugin.
229
+ // https://github.com/angular/angular-cli/blob/master/packages/angular_devkit/build_angular/src/browser/index.ts
230
+ extraPlugins . push ( new webpack_2 . BundleBudgetPlugin ( { budgets : buildOptions . budgets } ) ) ;
230
231
}
231
232
let sourceMapUseRule ;
232
233
if ( ( scriptsSourceMap || stylesSourceMap ) && vendorSourceMap ) {
@@ -268,7 +269,7 @@ function getCommonConfig(wco) {
268
269
catch ( _a ) { }
269
270
const extraMinimizers = [ ] ;
270
271
if ( stylesOptimization ) {
271
- extraMinimizers . push ( new optimize_css_webpack_plugin_1 . OptimizeCssWebpackPlugin ( {
272
+ extraMinimizers . push ( new webpack_2 . OptimizeCssWebpackPlugin ( {
272
273
sourceMap : stylesSourceMap ,
273
274
// component styles retain their original file name
274
275
test : file => / \. (?: c s s | s c s s | s a s s | l e s s | s t y l ) $ / . test ( file ) ,
@@ -438,13 +439,7 @@ function getCommonConfig(wco) {
438
439
minimizer : [
439
440
new webpack_1 . HashedModuleIdsPlugin ( ) ,
440
441
...extraMinimizers ,
441
- ] . concat ( differentialLoadingMode ? [
442
- // Budgets are computed after differential builds, not via a plugin.
443
- // https://github.com/angular/angular-cli/blob/master/packages/angular_devkit/build_angular/src/browser/index.ts
444
- ] : [
445
- // Non differential builds should be computed here, as a plugin.
446
- new bundle_budget_1 . BundleBudgetPlugin ( { budgets : buildOptions . budgets } ) ,
447
- ] ) ,
442
+ ] ,
448
443
} ,
449
444
plugins : [
450
445
// Always replace the context for the System.import in angular/core to prevent warnings.
0 commit comments