fix: update paths for playground (#9139)

pull/9140/head
Ben McCann 2 years 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 { fileURLToPath } from 'node:url';
import { watch } from 'rollup'; import { watch } from 'rollup';
import serve from 'rollup-plugin-serve'; 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 __dirname = fileURLToPath(new URL('.', import.meta.url));
const runtime_path = path.resolve(__dirname, '../../packages/svelte/src/runtime');
/** @returns {import('rollup').Plugin}*/ /** @returns {import('rollup').Plugin}*/
function create_plugin(ssr = false) { function create_plugin(ssr = false) {
@ -13,12 +14,9 @@ function create_plugin(ssr = false) {
name: 'custom-svelte-ssr-' + ssr, name: 'custom-svelte-ssr-' + ssr,
resolveId(id) { resolveId(id) {
if (id === 'svelte') { if (id === 'svelte') {
return path.resolve( return path.resolve(runtime_path, ssr ? 'ssr.js' : 'index.js');
__dirname,
ssr ? '../svelte/src/runtime/ssr.js' : '../svelte/src/runtime/index.js'
);
} else if (id.startsWith('svelte/')) { } 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) { transform(code, id) {

Loading…
Cancel
Save