use fileURLToPath

pull/8822/head
Simon Holthausen 3 years ago
parent dc0399aaa3
commit 0b99e256bd

@ -1,13 +1,11 @@
import { readFileSync, writeFileSync } from 'node:fs';
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';
let __dirname = new URL('.', import.meta.url).pathname;
if (process.platform === 'win32') {
__dirname = __dirname.slice(1); // else path.resolve fucks up
}
const __dirname = fileURLToPath(new URL('.', import.meta.url));
/** @returns {import('rollup').Plugin}*/
function create_plugin(ssr = false) {

@ -1,12 +1,10 @@
import { fileURLToPath } from 'node:url';
import { get_examples_data } from '../src/lib/server/examples/index.js';
import fs from 'node:fs';
let examples_path = new URL('../../../documentation/examples', import.meta.url).pathname;
if (process.platform === 'win32') {
examples_path = examples_path.slice(1); // remove leading slash
}
const examples_data = get_examples_data(examples_path);
const examples_data = get_examples_data(
fileURLToPath(new URL('../../../documentation/examples', import.meta.url))
);
try {
fs.mkdirSync(new URL('../src/lib/generated/', import.meta.url), { recursive: true });

Loading…
Cancel
Save