mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-20 21:42:38 +08:00
fix(@angular-devkit/build-angular): localize service worker base href
This commit is contained in:
parent
cae943d7e6
commit
713f95d678
@ -703,14 +703,24 @@ export function buildWebpackBrowser(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!options.watch && options.serviceWorker) {
|
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 {
|
try {
|
||||||
await augmentAppWithServiceWorker(
|
await augmentAppWithServiceWorker(
|
||||||
host,
|
host,
|
||||||
root,
|
root,
|
||||||
normalize(projectRoot),
|
normalize(projectRoot),
|
||||||
normalize(outputPath),
|
normalize(outputPath),
|
||||||
options.baseHref || '/',
|
localeBaseHref || options.baseHref || '/',
|
||||||
options.ngswConfigPath,
|
options.ngswConfigPath,
|
||||||
);
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user