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.
i18n is not yet implemented in Ivy, we should emit a warning stating this and exit gracefully.
This also swaps the readTsConfig logic to use `@angular/compiler-cli` instead of `typescript`. This is needed because when parsing the tsconfig, typescript is not aware of `angularCompilerOptions` and will not merged them if they are at un upper level tsconfig file when using `extends`.
Closes#14225
`caniuse-api` only returns `true` for a feature when it's fully supported. This might causes redundant ES5 builds if users opt to support only browsers which do support ES6 modules but either require polyfills such as Safari 10.1 or when both bundles will be downloaded such as `Edge 18`
See: 1b74c10257/src/index.js (L49) and https://github.com/Nyalab/caniuse-api/issues/82Fixes#14580
10.1 and iOS Safari 10.3
The nomodule polyfill needs to be loaded prior to any script and be
outside of webpack compilation because otherwise webpack will cause the
script to be wrapped in `window["webpackJsonp"]` which causes it to
fail.
This polyfill will only be injected when the either Safari 10.1 or iOS
Safari 10.3 support is required, which is based on the browsers defined in browserslist file.
Fixes#14680
The serve path represents the base of the application. Accessing a different path (`/api/` for instance) should not cause the application to load if the application's base is `/test/`
The underlying webpack dev server builder is responsible for determining the actual port value for dynamic port cases (port = 0). This change uses that value to generate the full URL for accessing the dev server.
We only use it for a few things but have a strict peerdep.
This strictness causes errors when updating the CLI from 7.x to 8.x projects:
```
Package "@angular/compiler-cli" has an incompatible peer dependency to "typescript" (requires ">=3.1.1 <3.2", would install "3.4.5").
```
`build-angular` did not have a peerdep in 7.x so this never was a problem.
This PR relaxes the peerdep to `">=3.1 < 3.5"`, which covers the 3.1 used in initial CLI 7.0 projects.
By default the application will be served with inline mode enabled. This means that a script will be inserted in your bundle to take care of live reloading.
However at the moment we are already adding these scripts in `_addLiveReload` method.
With this change we always disable this behaviour and only add it when needed via the `_addLiveReload` logic.
Eventually we should try to remove the logic and rely on webpack-dev-server interals.
Fixes#14300
When we first started using Build Optimizer, we saw a lot of the savings were tied to using the Uglify/Terser `pure_getters` option.
This was intimately related with the structure and shape of the Angular codebase. The measurements we did at the time on angular.io showed a significant size reduction, from 1mb to about 600kb. Of these roughly 150kb were tied to using `pure_getters` if I remember correctly.
Meanwhile the Angular codebase has changed significantly and I don't really see these savings anymore, so I don't think it makes sense to keep it on given that it is known to cause problems with some libraries.
Closes#9231, #11439, #12096, #12128.
When using differential loading with targets ES5 and ES2016+, the
browser with ESM support will pick `script[type="module"]` scripts even
without supporting ES2016+ syntax.
We want to warn users in this case.
Before, the build tasks ran in parallel and so the different webpack
instances competed over the same lines on the console.
To fail fast and to prevent to show the same errors twice, the second
build step is not executed if the first one fails.
As running these tasks in sequence causes issues with watch mode, this
PR also disables differential loading when watch mode is requested.