chore: fix local dev (#11074)

pull/11077/head
Rich Harris 1 year ago committed by GitHub
parent 8cbe8c1197
commit 071d6314d9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,4 +1,4 @@
import compiler_cjs from '../../../../../../packages/svelte/compiler/index.js?url';
import compiler_js from '../../../../../../packages/svelte/compiler/index.js?url';
import package_json from '../../../../../../packages/svelte/package.json?url';
import { read } from '$app/server';
@ -20,14 +20,18 @@ export function entries() {
// service worker requests files under this path to load the compiler and runtime
export async function GET({ params }) {
let url = '';
let file = '';
if (params.path === 'compiler/index.js') {
url = compiler_cjs;
file = compiler_js;
} else if (params.path === 'package.json') {
url = package_json;
file = package_json;
} else {
url = files[prefix + params.path];
file = /** @type {string} */ (files[prefix + params.path]);
// remove query string added by Vite when changing source code locally
file = file.split('?')[0];
}
return read(url);
return read(file);
}

Loading…
Cancel
Save