-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
expose base via $service-worker, make paths relative
#9250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
8bf17bf
6c36fd1
6567df3
2ab4a61
6dd34fc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@sveltejs/kit': minor | ||
| --- | ||
|
|
||
| feat: expose `base` via `$service-worker`, make paths relative |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,21 +36,23 @@ export async function build_service_worker( | |
| fs.writeFileSync( | ||
| service_worker, | ||
| dedent` | ||
| export const base = /*@__PURE__*/ location.pathname.split('/').slice(0, -1).join('/'); | ||
|
||
|
|
||
| export const build = [ | ||
| ${Array.from(build) | ||
| .map((file) => `${s(`${kit.paths.base}/${file}`)}`) | ||
| .map((file) => `base + ${s(`/${file}`)}`) | ||
| .join(',\n')} | ||
| ]; | ||
|
|
||
| export const files = [ | ||
| ${manifest_data.assets | ||
| .filter((asset) => kit.serviceWorker.files(asset.file)) | ||
| .map((asset) => `${s(`${kit.paths.base}/${asset.file}`)}`) | ||
| .map((asset) => `base + ${s(`/${asset.file}`)}`) | ||
| .join(',\n')} | ||
| ]; | ||
|
|
||
| export const prerendered = [ | ||
| ${prerendered.paths.map((path) => s(path)).join(',\n')} | ||
| ${prerendered.paths.map((path) => `base + ${s(path.replace(kit.paths.base, ''))}`).join(',\n')} | ||
| ]; | ||
|
|
||
| export const version = ${s(kit.version.name)}; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export const prerender = true; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| <h1>Prerendered</h1> |
Uh oh!
There was an error while loading. Please reload this page.