-
Notifications
You must be signed in to change notification settings - Fork 12k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(@angular-devkit/build-angular): correctly extract messages when u…
…sing cached build (#22266) * fix(@angular-devkit/build-angular): correctly extract messages when using cached build Extracted messages are not part of Webpack pipeline and hence they cannot be retrieved from cache. Therefore, we need to mark the extraction loader as non cacheable. Closes #22264 * fixup! fix(@angular-devkit/build-angular): correctly extract messages when using cached build (cherry picked from commit 52c6c3d)
- Loading branch information
1 parent
0a8c13d
commit b835389
Showing
3 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { join } from 'path'; | ||
import { getGlobalVariable } from '../../utils/env'; | ||
import { expectFileToMatch, rimraf, writeFile } from '../../utils/fs'; | ||
import { installPackage, uninstallPackage } from '../../utils/packages'; | ||
import { ng } from '../../utils/process'; | ||
import { updateJsonFile } from '../../utils/project'; | ||
import { readNgVersion } from '../../utils/version'; | ||
|
||
export default async function () { | ||
// Enable disk cache | ||
updateJsonFile('angular.json', (config) => { | ||
config.cli ??= {}; | ||
config.cli.cache = { environment: 'all' }; | ||
}); | ||
|
||
// Setup an i18n enabled component | ||
await ng('generate', 'component', 'i18n-test'); | ||
await writeFile(join('src/app/i18n-test', 'i18n-test.component.html'), '<p i18n>Hello world</p>'); | ||
|
||
// Install correct version | ||
let localizeVersion = '@angular/localize@' + readNgVersion(); | ||
if (getGlobalVariable('argv')['ng-snapshots']) { | ||
localizeVersion = require('../../ng-snapshot/package.json').dependencies['@angular/localize']; | ||
} | ||
|
||
await installPackage(localizeVersion); | ||
|
||
for (let i = 0; i < 2; i++) { | ||
// Run the extraction twice and make sure the second time round works with cache. | ||
await rimraf('messages.xlf'); | ||
await ng('extract-i18n'); | ||
await expectFileToMatch('messages.xlf', 'Hello world'); | ||
} | ||
|
||
await uninstallPackage('@angular/localize'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters