diff --git a/scripts/vite/src/paths.ts b/scripts/vite/src/paths.ts index a07f6b54..5bd44a0d 100644 --- a/scripts/vite/src/paths.ts +++ b/scripts/vite/src/paths.ts @@ -1,5 +1,5 @@ import { fileURLToPath } from 'url'; -import { resolve, dirname } from 'path'; +import { resolve, dirname, relative } from 'path'; import { cwd } from 'process'; function createPaths() { @@ -22,7 +22,13 @@ function createPaths() { proxySetup: resolve(user, 'service-worker.js'), // Paths relative to the source directory - entry: resolve(source, 'main.ts'), + /* + When this is an absolute path, on windows it will be loaded as `file://c:/...`. + Instead it would ideally be loaded as `/c:/...` as a valid "url". + However, if we make it relative like `src/main.ts`, it will work on both systems. + This path is inserted into the index.html, so we need to make it relative. + */ + entry: relative(paths.user, resolve(source, 'main.ts')), serviceWorker: resolve(source, 'service-worker.ts'), };