Skip to content

Commit 8545f58

Browse files
committed
refactor(@angular/build): use rolldown for experimental chunk optimization
Replaces rollup with rolldown for the experimental chunk optimization feature. This change is expected to improve performance of this feature.
1 parent 5d085ee commit 8545f58

File tree

5 files changed

+215
-10
lines changed

5 files changed

+215
-10
lines changed

packages/angular/build/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ ts_project(
111111
":node_modules/picomatch",
112112
":node_modules/piscina",
113113
":node_modules/postcss",
114+
":node_modules/rolldown",
114115
":node_modules/sass",
115116
":node_modules/source-map-support",
116117
":node_modules/tinyglobby",
@@ -135,7 +136,6 @@ ts_project(
135136
"//:node_modules/esbuild",
136137
"//:node_modules/esbuild-wasm",
137138
"//:node_modules/karma",
138-
"//:node_modules/rollup",
139139
"//:node_modules/semver",
140140
"//:node_modules/tslib",
141141
"//:node_modules/typescript",

packages/angular/build/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"parse5-html-rewriting-stream": "8.0.0",
3838
"picomatch": "4.0.3",
3939
"piscina": "5.1.3",
40-
"rollup": "4.45.1",
40+
"rolldown": "1.0.0-beta.29",
4141
"sass": "1.89.2",
4242
"semver": "7.7.2",
4343
"source-map-support": "0.5.21",

packages/angular/build/src/builders/application/chunk-optimizer.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
import assert from 'node:assert';
10-
import { rollup } from 'rollup';
10+
import { rolldown } from 'rolldown';
1111
import {
1212
BuildOutputFile,
1313
BuildOutputFileType,
@@ -65,7 +65,7 @@ export async function optimizeChunks(
6565
let bundle;
6666
let optimizedOutput;
6767
try {
68-
bundle = await rollup({
68+
bundle = await rolldown({
6969
input: mainFile,
7070
plugins: [
7171
{
@@ -101,7 +101,7 @@ export async function optimizeChunks(
101101
});
102102

103103
const result = await bundle.generate({
104-
compact: true,
104+
minify: { mangle: false, compress: false, removeWhitespace: true },
105105
sourcemap,
106106
chunkFileNames: (chunkInfo) => `${chunkInfo.name.replace(/-[a-zA-Z0-9]{8}$/, '')}-[hash].js`,
107107
});

packages/angular/build/src/tools/vite/plugins/ssr-transform-plugin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
*/
88

99
import remapping, { SourceMapInput } from '@ampproject/remapping';
10-
import type { SourceDescription } from 'rollup';
1110
import type { Plugin } from 'vite';
1211
import { loadEsmModule } from '../../../utils/load-esm';
1312

@@ -28,7 +27,8 @@ export async function createAngularSsrTransformPlugin(workspaceRoot: string): Pr
2827

2928
return {
3029
code,
31-
map: remappedMap as SourceDescription['map'],
30+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
31+
map: remappedMap as any,
3232
};
3333
},
3434
};

pnpm-lock.yaml

Lines changed: 208 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)