The dev-infra build tooling is now decoupled from `ng-dev`. This will
make it easier to update `ng-dev` without necessarily needing to upgrade
the whole build system, Bazel etc. This is useful when e.g. new release
tool features have been added and should also be ported to active LTS
branches.
The esbuild-based experimental builder will now leverage the bundler to perform resolution of CSS imports.
This allows for more comprehensive resolution including packages which use the `sass` and/or `style` custom
conditions within a `package.json` exports field.
This PR includes a webpack plugin which adds a field to source maps that identifies which sources are vendored or runtime-injected (aka third-party) sources. These will be consumed by Chrome DevTools to automatically ignore-list sources.
When vendor source map processing is enabled, this is interpreted as the developer intending to debug third-party code; in this case, the feature is disabled.
Signed-off-by: Victor Porof <victorporof@chromium.org>
The `sourcemap.vendor` build option for the esbuild-based browser application builder will now
properly be considered when processing sourcemaps for third-party code (code originating from
a `node_modules` directory).
This change adjusts the virtual output directory of the configuration for the experimental esbuild-based
browser application builder to be based on the workspace root. This allows esbuild to generate sourcemap
source paths that are relative to the workspace root and that do not contain path information from outside
the workspace root.
Instead of generating the content hash based on the content of scripts BEFORE the optimization phase,
the content hash is generated AFTER the optimization phase.
Prevents caching issues where browsers block execution of scripts due to the integrity hash not matching
with the cached script in case of a script being optimized differently than in a previous build,
where it would previously result in the same content hash.
Fixes#22906
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