Skip to content

Commit d61683e

Browse files
authored
feat(angular): migrate to angular rspack 21 (#31216)
## Current Behavior The Angular plugin currently uses Angular Rspack at `^20.7.0`. The latest release of Angular Rspack is `21.0.0` ## Expected Behavior Use the latest version of Angular Rspack
1 parent 81ecb22 commit d61683e

File tree

11 files changed

+70
-11
lines changed

11 files changed

+70
-11
lines changed

docs/blog/2025-03-19-using-angular-with-rspack.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,9 @@ The following are known limitations and missing features of Angular Rspack:
210210
- Angular's built-in support for Internationalization (i18n) is not supported. _**UPDATE**: As of Angular Rspack version 20.8, i18n is supported._
211211
- Server Routing is not supported - still experimental in Angular currently.
212212
- App Engine APIs are not supported - still experimental in Angular currently.
213-
- Optimization is not currently 1:1 with Angular's optimization - however, there are still great optimizations that are made.
214-
- Styles optimization for `inline-critical` and `remove-special-comments` are not yet implemented.
215-
- Inlining of fonts is not yet implemented.
213+
- Optimization is not currently 1:1 with Angular's optimization - however, there are still great optimizations that are made. _**UPDATE**: As of Angular Rspack version 21, Optimization is 1:1 with Angular's optimization._
216214
- Web Workers are not fully supported. _**UPDATE**: As of Angular Rspack version 20.8, Web Workers are supported._
217-
- Hot Module Replacement (HMR) is partially supported.
215+
- Hot Module Replacement (HMR) is partially supported. _**UPDATE**: As of Angular Rspack version 21, HMR is supported._
218216

219217
If you have any other missing features or limitations, please [let us know](https://github.com/nrwl/angular-rspack/issues/new).
220218

docs/blog/2025-04-14-scaffold-angular-rspack-applications.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ It’s been great to see the progress on Angular Rspack so far, but it’s not d
133133

134134
**[UPDATE - 2025-04-25]** - We've released version 20.8 of Angular Rspack that includes support for i18n.
135135
**[UPDATE - 2025-05-06]** - We've released version 20.9 of Angular Rspack that includes support for SSG.
136+
**[UPDATE - 2025-05-14]** - We've released version 21 of Angular Rspack that reaches feature parity with the Angular 19.2.
136137

137138
Stay tuned to our socials to stay up to date on the latest Angular Rspack news!
138139

docs/generated/manifests/nx-api.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,16 @@
444444
}
445445
},
446446
"migrations": {
447+
"/nx-api/angular/migrations/21.1.0-package-updates": {
448+
"description": "",
449+
"file": "generated/packages/angular/migrations/21.1.0-package-updates.json",
450+
"hidden": false,
451+
"name": "21.1.0-package-updates",
452+
"version": "21.1.0-beta.1",
453+
"originalFilePath": "/packages/angular",
454+
"path": "/nx-api/angular/migrations/21.1.0-package-updates",
455+
"type": "migration"
456+
},
447457
"/nx-api/angular/migrations/change-data-persistence-operators-imports-to-ngrx-router-store-data-persistence": {
448458
"description": "Change the data persistence operator imports to '@ngrx/router-store/data-persistence'.",
449459
"file": "generated/packages/angular/migrations/change-data-persistence-operators-imports-to-ngrx-router-store-data-persistence.json",

docs/generated/packages-metadata.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,16 @@
439439
}
440440
],
441441
"migrations": [
442+
{
443+
"description": "",
444+
"file": "generated/packages/angular/migrations/21.1.0-package-updates.json",
445+
"hidden": false,
446+
"name": "21.1.0-package-updates",
447+
"version": "21.1.0-beta.1",
448+
"originalFilePath": "/packages/angular",
449+
"path": "angular/migrations/21.1.0-package-updates",
450+
"type": "migration"
451+
},
442452
{
443453
"description": "Change the data persistence operator imports to '@ngrx/router-store/data-persistence'.",
444454
"file": "generated/packages/angular/migrations/change-data-persistence-operators-imports-to-ngrx-router-store-data-persistence.json",
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "21.1.0-package-updates",
3+
"version": "21.1.0-beta.1",
4+
"packages": {
5+
"@nx/angular-rspack": {
6+
"version": "^21.0.1",
7+
"alwaysAddToPackageJson": false
8+
}
9+
},
10+
"aliases": [],
11+
"description": "",
12+
"hidden": false,
13+
"implementation": "",
14+
"path": "/packages/angular",
15+
"schema": null,
16+
"type": "migration"
17+
}

docs/shared/guides/angular-rspack/introduction.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ The following are known limitations and missing features of Angular Rspack:
4141

4242
- Server Routing is not supported - still experimental in Angular currently.
4343
- App Engine APIs are not supported - still experimental in Angular currently.
44-
- Optimization is not currently 1:1 with Angular's optimization - however, there are still great optimizations that are made.
45-
- Styles optimization for `inline-critical` and `remove-special-comments` are not yet implemented.
46-
- Inlining of fonts is not yet implemented.
47-
- Hot Module Replacement (HMR) is partially supported.
4844

4945
If you have any other missing features or limitations, please [let us know](https://github.com/nrwl/angular-rspack/issues/new).
5046

e2e/angular/src/misc.test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
updateFile,
99
} from '@nx/e2e/utils';
1010
import { classify } from '@nx/devkit/src/utils/string-utils';
11+
import { join } from 'path';
1112

1213
describe('Move Angular Project', () => {
1314
let proj: string;
@@ -161,8 +162,14 @@ describe('Convert Angular Webpack Project to Rspack', () => {
161162

162163
it('should convert an Angular Webpack project to Rspack', async () => {
163164
runCLI(`generate @nx/angular:convert-to-rspack --project=${app1}`);
165+
const rspackConfigFileContents = readFile(join(app1, 'rspack.config.ts'));
166+
const updatedConfigFileContents = rspackConfigFileContents.replace(
167+
`maximumError: '1mb'`,
168+
`maximumError: '3mb'`
169+
);
170+
updateFile(join(app1, 'rspack.config.ts'), updatedConfigFileContents);
164171
const buildOutput = runCLI(`build ${app1}`);
165172
expect(buildOutput).toContain('rspack build');
166-
expect(buildOutput).toContain('browser compiled');
173+
expect(buildOutput).toContain('Successfully ran target build for project');
167174
});
168175
});

e2e/angular/src/projects.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,17 @@ describe('Angular Projects', () => {
154154
runCLI(
155155
`generate @nx/angular:app my-dir/${app} --bundler=rspack --no-interactive`
156156
);
157+
const rspackConfigFileContents = readFile(
158+
join('my-dir', app, 'rspack.config.ts')
159+
);
160+
const updatedConfigFileContents = rspackConfigFileContents.replace(
161+
`maximumError: '1mb'`,
162+
`maximumError: '3mb'`
163+
);
164+
updateFile(
165+
join('my-dir', app, 'rspack.config.ts'),
166+
updatedConfigFileContents
167+
);
157168
runCLI(`build ${app}`);
158169

159170
if (runE2ETests()) {

packages/angular/migrations.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1615,6 +1615,15 @@
16151615
"alwaysAddToPackageJson": false
16161616
}
16171617
}
1618+
},
1619+
"21.1.0": {
1620+
"version": "21.1.0-beta.1",
1621+
"packages": {
1622+
"@nx/angular-rspack": {
1623+
"version": "^21.0.1",
1624+
"alwaysAddToPackageJson": false
1625+
}
1626+
}
16181627
}
16191628
}
16201629
}

packages/angular/src/utils/versions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export const nxVersion = require('../../package.json').version;
33
export const angularVersion = '~19.2.0';
44
export const angularDevkitVersion = '~19.2.0';
55
export const ngPackagrVersion = '~19.2.0';
6-
export const angularRspackVersion = '^20.7.0';
6+
export const angularRspackVersion = '^21.0.1';
77
export const ngrxVersion = '^19.0.0';
88
export const rxjsVersion = '~7.8.0';
99
export const zoneJsVersion = '~0.15.0';

packages/workspace/src/utils/versions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ export const typescriptVersion = '~5.7.2';
55
// TODO: remove when preset generation is reworked and
66
// deps are not installed from workspace
77
export const angularCliVersion = '~19.2.0';
8-
export const angularRspackVersion = '^20.9.0';
8+
export const angularRspackVersion = '^21.0.1';

0 commit comments

Comments
 (0)