Skip to content

Commit 16c5a8b

Browse files
clydinKeen Yee Liau
authored and
Keen Yee Liau
committed
fix(@angular-devkit/build-angular): ensure output is ASCII only
Fixes: #16721
1 parent c288d55 commit 16c5a8b

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/common.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,9 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
404404
safari10: true,
405405
output: {
406406
ecma: terserEcma,
407+
// For differential loading, this is handled in the bundle processing.
408+
// This should also work with just true but the experimental rollup support breaks without this check.
409+
ascii_only: !differentialLoadingMode,
407410
// default behavior (undefined value) is to keep only important comments (licenses, etc.)
408411
comments: !buildOptions.extractLicenses && undefined,
409412
webkit: true,

packages/angular_devkit/build_angular/test/browser/optimization-level_spec_large.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,17 @@ describe('Browser Builder optimization level', () => {
7979
expect(await files['main.js']).toContain('color: white');
8080
expect(await files['styles.css']).toContain('color: white');
8181
});
82+
83+
it('outputs ASCII only content', async () => {
84+
const overrides = { aot: true, optimization: true };
85+
86+
host.writeMultipleFiles({
87+
'src/app/app.component.html': `<p>€€€</p>`,
88+
});
89+
90+
const { files } = await browserBuild(architect, host, target, overrides);
91+
expect(await files['main.js']).not.toContain('ɵ');
92+
expect(await files['main.js']).not.toContain('€€€');
93+
expect(await files['main.js']).toContain('\\u20ac\\u20ac\\u20ac');
94+
});
8295
});

tests/legacy-cli/e2e/tests/basic/ivy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export default async function() {
4242
const mainUrl = mainUrlMatch && mainUrlMatch[1];
4343
const main = await request('http://localhost:4200/' + mainUrl);
4444

45-
if (!main.match(/ɵcmp\s*=/)) {
45+
if (!main.match(/ɵcmp\s*=/) && !main.match(/\\u0275cmp\s*=/)) {
4646
throw new Error('Ivy could not be found.');
4747
}
4848
if (main.match(/ngDevMode/)) {

0 commit comments

Comments
 (0)