Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): ensure output is ASCII only
Browse files Browse the repository at this point in the history
Fixes: #16721
  • Loading branch information
clydin committed Jan 23, 2020
1 parent 7cce3f0 commit 2439a06
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
Expand Up @@ -404,6 +404,9 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
safari10: true,
output: {
ecma: terserEcma,
// For differential loading, this is handled in the bundle processing.
// The experimental rollup support breaks without this check.
ascii_only: !differentialLoadingMode,
// default behavior (undefined value) is to keep only important comments (licenses, etc.)
comments: !buildOptions.extractLicenses && undefined,
webkit: true,
Expand Down
Expand Up @@ -79,4 +79,17 @@ describe('Browser Builder optimization level', () => {
expect(await files['main.js']).toContain('color: white');
expect(await files['styles.css']).toContain('color: white');
});

it('outputs ASCII only content', async () => {
const overrides = { aot: true, optimization: true };

host.writeMultipleFiles({
'src/app/app.component.html': `<p>€€€</p>`,
});

const { files } = await browserBuild(architect, host, target, overrides);
expect(await files['main.js']).not.toContain('ɵ');
expect(await files['main.js']).not.toContain('€€€');
expect(await files['main.js']).toContain('\\u20ac\\u20ac\\u20ac');
});
});
2 changes: 1 addition & 1 deletion tests/legacy-cli/e2e/tests/basic/ivy.ts
Expand Up @@ -42,7 +42,7 @@ export default async function() {
const mainUrl = mainUrlMatch && mainUrlMatch[1];
const main = await request('http://localhost:4200/' + mainUrl);

if (!main.match(/ɵcmp\s*=/)) {
if (!main.match(/ɵcmp\s*=/) && !main.match(/\\u0275cmp\s*=/)) {
throw new Error('Ivy could not be found.');
}
if (main.match(/ngDevMode/)) {
Expand Down

0 comments on commit 2439a06

Please sign in to comment.