This change adds support for using Sass stylesheets within an application built with the experimental
esbuild-based browser application builder. Global stylesheets (`styles` build option) and component
stylesheets (`@Component({ styleUrls: [...], ...})`) with Sass can now be used.
The `stylePreprocessorOptions.includePaths` option is also available for Sass stylesheets.
Both the default format (`.scss`) and the indented format (`.sass`) are supported.
Inline component stylesheet support is not yet available with the esbuild-based builder.
The hidden stylesheet option was incorrectly being ignored for component
stylesheets when using the experimental esbuild-based browser application
builder. The hidden option will now correctly not include the stylesheet
comment within the stylesheet text for components.
By default, a glob pattern starting with a forward slash will be "mounted" onto the system root. This causes globs to escape the workspace root.
With this change we configure disable glob "mounting" and also change the root to the same setting of the `cwd`.
Closes#23467
With this change we remove the usage of hard coded `src` directory and instead infer this from the `sourceRoot` project option.
We also remove the `angularCompilerOptions.entryModule` property in the server tsconfig as this is no longer needed with Ivy.
Closes#12104
When using localization we setup `SIGINT` signal to delete the temporary directory. In some cases this resulted in delaying the process from exiting a couple of seconds.
Closes#22216
During testing architect isn't spawned as a new process therefore we the global state can be tained from previous runs.
`es5TargetWarningsShown` which was saved in the global state caused flakiness.
Since version 4, webpack-dev-server by default will shutdown gracefully. This results in `CTRL+C` needed to be pressed multiple times to exit the process.
See: c76b6d11a3/lib/Server.js (L1801-L1827)Closes#22216
This commit add a new `externalDependencies` option to the experimental browser builder.
Dependencies listed in this option will not be included in the final bundle, instead the user would need to provide them at runtime using import maps or another method.
Closes#23322
Service worker augmentation of an application is now supported when using the experimental
`browser-esbuild` application builder. Both the `serviceWorker` and `ngswConfigPath` options
are now available for use.
The implementation leverages the `augmentAppWithServiceWorker` internal function that is used
by the Webpack-based builder. This function currently reads the application files from the
filesystem after all the application files are written. With the `browser-esbuild`builder, all
application files are available in-memory. This can allow a future version of the service worker
code to avoid additional file access and further improve build time performance when using a
service worker. Future work will investigate the creation of an `augmentAppWithServiceWorker`
variant that supports accessing these in-memory files.
Prepares the `@angular-devkit/build-angular` package for the eventual change of enabling the
TypeScript `useUnknownInCatchVariables` option. This option provides additional
code safety by ensuring that the catch clause variable is the proper type before
attempting to access its properties. Similar changes will be needed in the other
packages in the repository prior to enabling `useUnknownInCatchVariables`.
With this change we print out the modified and removed files when running a build in verbose mode. This can be useful to debug builds that rebuilds multiple times without an apparent file change.
Only the `replaceBootstrap` TypeScript transform is needed with the `browser-esbuild` builder.
The `replaceBootstrap` transform converts the default generated JIT bootstrap call into an AOT
bootstrap call within an application. The other transforms were used to remove the development
and JIT related metadata from the AOT compiler generated code. However, with the esbuild based
build pipeline, these will be automatically removed without the need for additional transforms
via the earlier usage of the `ngJitMode` and `ngDevMode` defines.
In some cases `/ws` caused conflicts with local websocket connections. Hence we change the dev-server web socket path to something more specific to the Angular CLI.
Closes#23260
The `es2015` exports package condition is used by `rxjs` to allow bundlers to use the ES2015-based
ESM code instead of the default of ES5-based ESM code. The ES5-based ESM code is larger in size
and harder to optimize due to the downlevelled classes. This change results in a ~5Kb size reduction
for the main bundle of a new application (129920 -> 124183).
There is no standard for library authors to ship their library in different ES versions, which can result in vendor libraries to ship ES features which are not supported by one or more browsers that the user's application supports.
With this change, we will be downlevelling libraries based on the list of supported browsers which is configured in the browserslist configuration. Previously, we only downlevelled libraries when targeting ES5.
The TypeScript target option will not effect how the libraries get downlevelled.
Closes#23126
When running protractor, previously we didn't close the dev-server correctly when there was an error which caused the process to keep running following https://github.com/angular/angular-cli/pull/23166
This can be useful to debug slow builds.
Example of output
```
LOG from build-angular.JavaScriptOptimizerPlugin
<t> optimize asset: runtime.ad5c30339e926c89.js: 221.959564 ms
<t> optimize asset: polyfills.ec3ffae5bac27204.js: 1071.080092 ms
<t> optimize asset: main.aa8a15155ca2133f.js: 3391.588635 ms
<t> optimize js assets: 3483.799739 ms
LOG from build-angular.CssOptimizerPlugin
<t> optimize asset: styles.d251c5bf54715558.css: 26.569907 ms
<t> optimize css assets: 34.441737 ms
```
```
LOG from build-angular.JavaScriptOptimizerPlugin
<i> polyfills.ec3ffae5bac27204.js restored from cache.
<i> runtime.ad5c30339e926c89.js restored from cache.
<t> optimize asset: main.69fb55a243b46bfa.js: 2618.5191210000003 ms
<t> optimize js assets: 2721.226144 ms
LOG from build-angular.CssOptimizerPlugin
<i> styles.d251c5bf54715558.css restored from cache.
<t> optimize css assets: 12.149169 ms
```