You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 12b0e89
Browse filesBrowse the repository at this point in the historyBrowse files
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.
Copy file name to clipboardExpand all lines: adev/src/content/tools/cli/build-system-migration.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ New applications will use this new build system by default via the `application`
22
22
## For existing applications
23
23
24
24
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.
26
26
Prior to migrating, please consider reviewing the [Known Issues](#known-issues) section as it may contain relevant information for your project.
27
27
28
28
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
33
33
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.
34
34
After the migration, please attempt a build of the application as there could be new errors that will require adjustments within the code.
35
35
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:
38
38
39
39
```shell
40
40
@@ -68,7 +68,7 @@ If the `application` builder is difficult for your project to adopt, `browser-es
68
68
69
69
#### Manual migration to the compatibility builder
70
70
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.
72
72
You can try out the new build system for applications that use the `browser` builder.
73
73
If using a custom builder, please refer to the documentation for that builder on possible migration options.
74
74
@@ -98,8 +98,8 @@ Changing the `builder` field is the only change you will need to make.
98
98
99
99
#### Manual migration to the new `application` builder
100
100
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`).
103
103
104
104
The following is what you would typically find in `angular.json` for an application:
105
105
@@ -252,9 +252,9 @@ However, excluding specific dependencies is recommended instead since rebuild ti
252
252
One of the main benefits of the application build system is the improved build and rebuild speed.
253
253
However, the new application build system also provides additional features not present in the `browser` builder.
254
254
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.
258
258
If you notice any issues, please report them [here](https://github.com/angular/angular-cli/issues).
259
259
260
260
### Build-time value replacement with `define`
@@ -392,8 +392,8 @@ For the import attribute, the following loader values are supported:
392
392
- `dataurl` - inlines the content as a [data URL](https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs).
393
393
- `base64` - inlines the content as a Base64-encoded string.
394
394
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.
397
397
398
398
At this time, TypeScript does not support type definitions that are based on import attribute values.
399
399
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