Skip to content

Commit 12b0e89

Browse files
MeAkibalxhub
authored andcommitted
docs: update the build system migration guide for current defaults
New applications use `@angular/build`, not `@angular-devkit/build-angular`. Scope the `builderMode` note to the devkit Karma builder, since the `@angular/build` test builders always use the application builder. Note that `module: preserve`, the default for new projects, supports import attributes, and that `ng update` offers the migration on each major update, not only v18.
1 parent 4c7783f commit 12b0e89

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

‎adev/src/content/tools/cli/build-system-migration.md‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ New applications will use this new build system by default via the `application`
2222
## For existing applications
2323

2424
Both automated and manual procedures are available depending on the requirements of the project.
25-
Starting with v18, the update process will ask if you would like to migrate existing applications to use the new build system via the automated migration.
25+
Since v18, the update process to a new major version asks if you would like to migrate existing applications to use the new build system via the automated migration.
2626
Prior to migrating, please consider reviewing the [Known Issues](#known-issues) section as it may contain relevant information for your project.
2727

2828
HELPFUL: Remember to remove any CommonJS assumptions in the application server code if using SSR such as `require`, `__filename`, `__dirname`, or other constructs from the [CommonJS module scope](https://nodejs.org/api/modules.html#the-module-scope). All application code should be ESM compatible. This does not apply to third-party dependencies.
@@ -33,8 +33,8 @@ The automated migration will adjust both the application configuration within `a
3333
While many changes can be automated and most applications will not require any further changes, each application is unique and there may be some manual changes required.
3434
After the migration, please attempt a build of the application as there could be new errors that will require adjustments within the code.
3535
The errors will attempt to provide solutions to the problem when possible and the later sections of this guide describe some of the more common situations that you may encounter.
36-
When updating to Angular v18 via `ng update`, you will be asked to execute the migration.
37-
This migration is entirely optional for v18 and can also be run manually at anytime after an update via the following command:
36+
When updating to a new major version via `ng update`, you will be asked to execute the migration.
37+
This migration is entirely optional and can also be run manually at anytime after an update via the following command:
3838

3939
```shell
4040

@@ -68,7 +68,7 @@ If the `application` builder is difficult for your project to adopt, `browser-es
6868

6969
#### Manual migration to the compatibility builder
7070

71-
A builder named `browser-esbuild` is available within the `@angular-devkit/build-angular` package that is present in an Angular CLI generated application.
71+
A builder named `browser-esbuild` is available within the `@angular-devkit/build-angular` package that applications using the `browser` builder already depend on.
7272
You can try out the new build system for applications that use the `browser` builder.
7373
If using a custom builder, please refer to the documentation for that builder on possible migration options.
7474

@@ -98,8 +98,8 @@ Changing the `builder` field is the only change you will need to make.
9898

9999
#### Manual migration to the new `application` builder
100100

101-
A builder named `application` is also available within the `@angular-devkit/build-angular` package that is present in an Angular CLI generated application.
102-
This builder is the default for all new applications created via `ng new`.
101+
A builder named `application` is also available within the `@angular-devkit/build-angular` package.
102+
New applications created via `ng new` use the same builder from the `@angular/build` package (`@angular/build:application`).
103103

104104
The following is what you would typically find in `angular.json` for an application:
105105

@@ -252,9 +252,9 @@ However, excluding specific dependencies is recommended instead since rebuild ti
252252
One of the main benefits of the application build system is the improved build and rebuild speed.
253253
However, the new application build system also provides additional features not present in the `browser` builder.
254254

255-
IMPORTANT: The new features of the `application` builder described here are incompatible with the `karma` test builder by default because it is using the `browser` builder internally.
256-
Users can opt-in to use the `application` builder by setting the `builderMode` option to `application` for the `karma` builder.
257-
This option is currently in developer preview.
255+
IMPORTANT: The new features of the `application` builder described here are incompatible with the `@angular-devkit/build-angular:karma` test builder by default because it is using the `browser` builder internally.
256+
Users can opt-in to use the `application` builder by setting the `builderMode` option to `application` for that builder.
257+
The `@angular/build:karma` and `@angular/build:unit-test` builders always use the `application` builder.
258258
If you notice any issues, please report them [here](https://github.com/angular/angular-cli/issues).
259259

260260
### Build-time value replacement with `define`
@@ -392,8 +392,8 @@ For the import attribute, the following loader values are supported:
392392
- `dataurl` - inlines the content as a [data URL](https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs).
393393
- `base64` - inlines the content as a Base64-encoded string.
394394

395-
An additional requirement to use import attributes is that the TypeScript `module` option must be set to `esnext` to allow TypeScript to successfully build the application code.
396-
Once `ES2025` is available within TypeScript, this change will no longer be needed.
395+
An additional requirement to use import attributes is that the TypeScript `module` option must be set to `esnext` or `preserve` to allow TypeScript to successfully build the application code.
396+
New projects use `preserve` by default, so no change is needed.
397397

398398
At this time, TypeScript does not support type definitions that are based on import attribute values.
399399
The use of `@ts-expect-error`/`@ts-ignore` or the use of individual type definition files (assuming the file is only imported with the same loader attribute) is currently required.

0 commit comments

Comments
 (0)