Skip to content

fix(@angular-devkit/build-angular): correctly ignore inline styles during i18n extraction #20971

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
May 31, 2021
Merged
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
Original file line number Diff line number Diff line change
@@ -240,7 +240,7 @@ export async function execute(
path.join(__dirname, 'empty-export-default.js'),
),
new webpack.NormalModuleReplacementPlugin(
/^angular-resource:\/\//,
/^angular-resource:style,/,
path.join(__dirname, 'empty-export-default.js'),
),
],
Original file line number Diff line number Diff line change
@@ -146,4 +146,17 @@ describe('Extract i18n Target', () => {
const fullLog = logs.join();
expect(fullLog).toContain('Duplicate messages with id');
});

it('ignores inline styles', async () => {
host.appendToFile('src/app/app.component.html', '<p i18n>i18n test</p>');
host.replaceInFile('src/app/app.component.ts', 'styleUrls', 'styles');
host.replaceInFile('src/app/app.component.ts', './app.component.css', 'h1 { color: green; }');

const run = await architect.scheduleTarget(extractI18nTargetSpec);

// This will fail if a style is processed since the style rules are not included during extraction
await expectAsync(run.result).toBeResolvedTo(jasmine.objectContaining({ success: true }));

await run.stop();
});
});