Skip to content

refactor(@angular/build): use rolldown for experimental chunk optimization #30765

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/angular/build/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ ts_project(
":node_modules/picomatch",
":node_modules/piscina",
":node_modules/postcss",
":node_modules/rolldown",
":node_modules/sass",
":node_modules/source-map-support",
":node_modules/tinyglobby",
Expand All @@ -135,7 +136,6 @@ ts_project(
"//:node_modules/esbuild",
"//:node_modules/esbuild-wasm",
"//:node_modules/karma",
"//:node_modules/rollup",
"//:node_modules/semver",
"//:node_modules/tslib",
"//:node_modules/typescript",
Expand Down
2 changes: 1 addition & 1 deletion packages/angular/build/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"parse5-html-rewriting-stream": "8.0.0",
"picomatch": "4.0.3",
"piscina": "5.1.3",
"rollup": "4.45.1",
"rolldown": "1.0.0-beta.29",
"sass": "1.89.2",
"semver": "7.7.2",
"source-map-support": "0.5.21",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import assert from 'node:assert';
import { rollup } from 'rollup';
import { rolldown } from 'rolldown';
import {
BuildOutputFile,
BuildOutputFileType,
Expand Down Expand Up @@ -65,7 +65,7 @@ export async function optimizeChunks(
let bundle;
let optimizedOutput;
try {
bundle = await rollup({
bundle = await rolldown({
input: mainFile,
plugins: [
{
Expand Down Expand Up @@ -101,7 +101,7 @@ export async function optimizeChunks(
});

const result = await bundle.generate({
compact: true,
minify: { mangle: false, compress: false, removeWhitespace: true },
sourcemap,
chunkFileNames: (chunkInfo) => `${chunkInfo.name.replace(/-[a-zA-Z0-9]{8}$/, '')}-[hash].js`,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/

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

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

return {
code,
map: remappedMap as SourceDescription['map'],
// eslint-disable-next-line @typescript-eslint/no-explicit-any
map: remappedMap as any,
};
},
};
Expand Down
211 changes: 208 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions tests/legacy-cli/e2e.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ WEBPACK_IGNORE_TESTS = [
"tests/build/wasm-esm.js",
"tests/build/auto-csp*",
"tests/build/incremental-watch.js",
"tests/build/chunk-optimizer.js",
]

def _to_glob(patterns):
Expand Down
Loading
Loading