Skip to content

Commit 6f8ec65

Browse files
authored
Chore: Fix docs:watch to work on Windows (#213)
* Chore: Fix `docs:watch` to work on Windows * update * revert
1 parent 7e7a154 commit 6f8ec65

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

docs-svelte-kit/build-system/build.mts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import esbuild from "esbuild"
22
import path from "path"
33
import fs from "fs"
4+
import { fileURLToPath } from "url"
45
// const babelCore = require("@babel/core")
56
// const t = require("@babel/types")
67

78
const dirname = path.dirname(
8-
new URL(
9+
fileURLToPath(
910
// @ts-expect-error -- Cannot change `module` option
1011
import.meta.url,
11-
).pathname,
12+
),
1213
)
1314

1415
build(

svelte.config.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import ghpagesAdapter from "svelte-adapter-ghpages"
22
import path from "path"
33
import fs from "fs"
4+
import { fileURLToPath } from "url"
45

56
// eslint-disable-next-line no-undef -- There seems to be a package that uses `self`.
67
if (typeof self === "undefined") {
78
globalThis.self = globalThis
89
}
910

10-
const dirname = path.dirname(new URL(import.meta.url).pathname)
11+
const dirname = path.dirname(fileURLToPath(import.meta.url))
1112

1213
// This project can't be ESM yet, so hack it to get svelte-kit to work.
1314
// A hack that treats files in the `.svelte-kit` directory as ESM.

vite.config.mts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ import svelteMdOption from "./docs-svelte-kit/tools/vite-plugin-svelte-md-option
66

77
import "./docs-svelte-kit/build-system/build.mts"
88
import type { UserConfig } from "vite"
9+
import { fileURLToPath } from "url"
910

1011
const dirname = path.dirname(
11-
new URL(
12+
fileURLToPath(
1213
// @ts-expect-error -- Cannot change `module` option
1314
import.meta.url,
14-
).pathname,
15+
),
1516
)
1617

1718
/** @type {import('vite').UserConfig} */

0 commit comments

Comments
 (0)