fix: update paths for playground (#9139)

pull/9140/head
Ben McCann 11 months ago committed by GitHub
parent d6f0981452
commit 3c9e661f4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3,9 +3,10 @@ import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { watch } from 'rollup';
import serve from 'rollup-plugin-serve';
import * as svelte from '../svelte/src/compiler/index.js';
import * as svelte from '../../packages/svelte/src/compiler/index.js';
const __dirname = fileURLToPath(new URL('.', import.meta.url));
const runtime_path = path.resolve(__dirname, '../../packages/svelte/src/runtime');
/** @returns {import('rollup').Plugin}*/
function create_plugin(ssr = false) {
@ -13,12 +14,9 @@ function create_plugin(ssr = false) {
name: 'custom-svelte-ssr-' + ssr,
resolveId(id) {
if (id === 'svelte') {
return path.resolve(
__dirname,
ssr ? '../svelte/src/runtime/ssr.js' : '../svelte/src/runtime/index.js'
);
return path.resolve(runtime_path, ssr ? 'ssr.js' : 'index.js');
} else if (id.startsWith('svelte/')) {
return path.resolve(__dirname, `../svelte/src/runtime/${id.slice(7)}/index.js`);
return path.resolve(runtime_path, `${id.slice(7)}/index.js`);
}
},
transform(code, id) {

Loading…
Cancel
Save