Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): Set chunk names explicitly
Browse files Browse the repository at this point in the history
Explicitly set chunk name pattern to exclude them from Jest run
  • Loading branch information
gultyayev authored and clydin committed Jul 14, 2023
1 parent 5908ede commit 5048f6e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ function getEsBuildCommonOptions(options: NormalizedApplicationBuildOptions): Bu
outExtension: outExtension ? { '.js': `.${outExtension}` } : undefined,
sourcemap: sourcemapOptions.scripts && (sourcemapOptions.hidden ? 'external' : true),
splitting: true,
chunkNames: 'chunk-[hash]',
tsconfig,
external: externalDependencies,
write: false,
Expand Down
9 changes: 5 additions & 4 deletions tests/legacy-cli/e2e/tests/basic/rebuild.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { waitForAnyProcessOutputToMatch, silentNg } from '../../utils/process';
import { writeFile, writeMultipleFiles } from '../../utils/fs';
import fetch from 'node-fetch';
import { ngServe } from '../../utils/project';
import { getGlobalVariable } from '../../utils/env';
import { writeFile, writeMultipleFiles } from '../../utils/fs';
import { silentNg, waitForAnyProcessOutputToMatch } from '../../utils/process';
import { ngServe } from '../../utils/project';

export default async function () {
const esbuild = getGlobalVariable('argv')['esbuild'];
const validBundleRegEx = esbuild ? /complete\./ : /Compiled successfully\./;
const lazyBundleRegEx = esbuild ? /lazy\.module/ : /lazy_module_ts\.js/;
const lazyBundleRegEx = esbuild ? /chunk-/ : /lazy_module_ts\.js/;

const port = await ngServe();
// Add a lazy module.
Expand All @@ -17,6 +17,7 @@ export default async function () {
// We need to use Promise.all to ensure we are waiting for the rebuild just before we write
// the file, otherwise rebuilds can be too fast and fail CI.
// Count the bundles.
// Verify that a new chunk was created.
await Promise.all([
waitForAnyProcessOutputToMatch(lazyBundleRegEx),
writeFile(
Expand Down

0 comments on commit 5048f6e

Please sign in to comment.