chore: fix playground paths

pull/9139/head^2
gtmnayan 3 years ago
parent d6f0981452
commit e922d72a5f

@ -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 svelte_path = path.resolve(__dirname, '../../packages/svelte');
/** @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(svelte_path, ssr ? 'src/runtime/ssr.js' : 'src/runtime/index.js');
} else if (id.startsWith('svelte/')) {
return path.resolve(__dirname, `../svelte/src/runtime/${id.slice(7)}/index.js`);
return path.resolve(svelte_path, `src/runtime/${id.slice(7)}/index.js`);
}
},
transform(code, id) {

Loading…
Cancel
Save