Skip to content

Commit 10200f1

Browse files
alan-agius4mgechev
authored andcommitted
fix(@angular-devkit/build-angular): remove certain redundant build steps from second build in differential loading
With this change we remove styles compilation and copying of assets for the second build when differential loading is enabled. This should improve the build times for larger applications.
1 parent 0701afc commit 10200f1

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

packages/angular_devkit/build_angular/src/utils/webpack-browser-config.ts

+14-5
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,29 @@ export async function generateWebpackConfig(
6868
// For differential loading, we can have several targets
6969
return scriptTargets.map(scriptTarget => {
7070
let buildOptions: NormalizedBrowserBuilderSchema = { ...options };
71+
const supportES2015
72+
= scriptTarget !== ts.ScriptTarget.ES3 && scriptTarget !== ts.ScriptTarget.ES5;
73+
7174
if (differentialLoading) {
72-
// For differential loading, the builder needs to created the index.html by itself
73-
// without using a webpack plugin.
7475
buildOptions = {
7576
...options,
77+
...(
78+
// FIXME: we do create better webpack config composition to achieve the below
79+
// When DL is enabled and supportES2015 is true it means that we are on the second build
80+
// This also means that we don't need to include styles and assets multiple times
81+
supportES2015
82+
? {}
83+
: {
84+
styles: options.extractCss ? [] : options.styles,
85+
assets: [],
86+
}
87+
),
7688
es5BrowserSupport: undefined,
7789
esVersionInFileName: true,
7890
scriptTargetOverride: scriptTarget,
7991
};
8092
}
8193

82-
const supportES2015
83-
= scriptTarget !== ts.ScriptTarget.ES3 && scriptTarget !== ts.ScriptTarget.ES5;
84-
8594
const wco: BrowserWebpackConfigOptions = {
8695
root: workspaceRoot,
8796
logger: logger.createChild('webpackConfigOptions'),

0 commit comments

Comments
 (0)