Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): localize service worker base href
Browse files Browse the repository at this point in the history
  • Loading branch information
clydin authored and Keen Yee Liau committed Dec 10, 2019
1 parent 8d181b6 commit 8bb6799
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions packages/angular_devkit/build_angular/src/browser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -729,14 +729,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) {
Expand Down

0 comments on commit 8bb6799

Please sign in to comment.