Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): correctly ignore inline styles du…
Browse files Browse the repository at this point in the history
…ring i18n extraction

Fixes angular#20968
  • Loading branch information
clydin committed May 27, 2021
1 parent 638344a commit 8854b4c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
});

0 comments on commit 8854b4c

Please sign in to comment.