fix(@angular-devkit/build-angular): localize service worker base href

This commit is contained in:
Charles Lyding 2019-12-04 13:40:35 -05:00 committed by Keen Yee Liau
parent cae943d7e6
commit 713f95d678

View File

@ -703,14 +703,24 @@ export function buildWebpackBrowser(
}
if (!options.watch && options.serviceWorker) {
for (const outputPath of outputPaths.values()) {
for (const [locale, outputPath] of outputPaths.entries()) {
let localeBaseHref;
if (i18n.locales[locale] && i18n.locales[locale].baseHref !== '') {
localeBaseHref = path.posix.join(
options.baseHref || '',
i18n.locales[locale].baseHref === undefined
? `/${locale}/`
: i18n.locales[locale].baseHref,
);
}
try {
await augmentAppWithServiceWorker(
host,
root,
normalize(projectRoot),
normalize(outputPath),
options.baseHref || '/',
localeBaseHref || options.baseHref || '/',
options.ngswConfigPath,
);
} catch (err) {