Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd2bd7f6

Browse files
committed
refactor(@angular/build): remove advanced chunking option in experimental chunk optimizer
Removes the experimental `advancedChunks` configuration from the Rolldown-based chunk optimizer. This experimental feature is being temporarily removed to allow for further refinement and testing of the chunking strategy.A new E2E test (`chunk-optimizer-lazy`) has been added to validate the default chunking behavior with multiple lazy-loaded routes, ensuring that the optimizer still produces a reasonable number of output files without the advanced configuration.
1 parent50072cd commitd2bd7f6

File tree

3 files changed

+53
-1
lines changed

3 files changed

+53
-1
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,6 @@ export async function optimizeChunks(
253253

254254
constresult=awaitbundle.generate({
255255
minify:{mangle:false,compress:false},
256-
advancedChunks:{minSize:8192},
257256
sourcemap,
258257
chunkFileNames:(chunkInfo)=>`${chunkInfo.name.replace(/-[a-zA-Z0-9]{8}$/,'')}-[hash].js`,
259258
});

‎tests/legacy-cli/e2e.bzl‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ WEBPACK_IGNORE_TESTS = [
5656
"tests/build/auto-csp*",
5757
"tests/build/incremental-watch.js",
5858
"tests/build/chunk-optimizer.js",
59+
"tests/build/chunk-optimizer-lazy.js",
5960
]
6061

6162
def_to_glob(patterns):
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
importassertfrom'node:assert/strict';
2+
import{readdir}from'node:fs/promises';
3+
import{replaceInFile}from'../../utils/fs';
4+
import{execWithEnv,ng}from'../../utils/process';
5+
6+
exportdefaultasyncfunction(){
7+
// Add lazy routes.
8+
awaitng('generate','component','lazy-a');
9+
awaitng('generate','component','lazy-b');
10+
awaitng('generate','component','lazy-c');
11+
awaitreplaceInFile(
12+
'src/app/app.routes.ts',
13+
'routes: Routes = [];',
14+
`routes: Routes = [
15+
{
16+
path: 'lazy-a',
17+
loadComponent: () => import('./lazy-a/lazy-a').then(m => m.LazyA),
18+
},
19+
{
20+
path: 'lazy-b',
21+
loadComponent: () => import('./lazy-b/lazy-b').then(m => m.LazyB),
22+
},
23+
{
24+
path: 'lazy-c',
25+
loadComponent: () => import('./lazy-c/lazy-c').then(m => m.LazyC),
26+
},
27+
];`,
28+
);
29+
30+
// Build without chunk optimization
31+
awaitng('build','--output-hashing=none');
32+
constunoptimizedFiles=awaitreaddir('dist/test-project/browser');
33+
constunoptimizedJsFiles=unoptimizedFiles.filter((f)=>f.endsWith('.js'));
34+
35+
// Build with chunk optimization
36+
awaitexecWithEnv('ng',['build','--output-hashing=none'],{
37+
...process.env,
38+
NG_BUILD_OPTIMIZE_CHUNKS:'1',
39+
});
40+
constoptimizedFiles=awaitreaddir('dist/test-project/browser');
41+
constoptimizedJsFiles=optimizedFiles.filter((f)=>f.endsWith('.js'));
42+
43+
// Check that the number of chunks is reduced but not all combined
44+
assert.ok(
45+
optimizedJsFiles.length<unoptimizedJsFiles.length,
46+
`Expected chunk count to be less than${unoptimizedJsFiles.length}, but was${optimizedJsFiles.length}.`,
47+
);
48+
assert.ok(
49+
optimizedJsFiles.length>1,
50+
`Expected more than one chunk, but found${optimizedJsFiles.length}.`,
51+
);
52+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp