jthegedus / svelte-adapter-firebase

SvelteKit adapter for Firebase Hosting rewrites to Cloud Functions for a Svelte SSR experience

Home Page:https://github.com/jthegedus/svelte-adapter-firebase

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug: entry.js generation does not reference import paths correctly on Windows.

Avislux opened this issue · comments

Describe the Bug

When running svelte-kit build with the adapter enabled, the build fails after the vite transformation. I am on Windows 10.
Here's an snippet of the output.

`> Using svelte-adapter-firebase
X [ERROR] Could not resolve "../H:directoryto.svelte-kit/output/server/index.js"

.svelte-kit/firebase/entry.js:1:21:
  1 │ import {Server} from '../H:\directory\to/output/server/index.js';
    ╵                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

X [ERROR] Could not resolve "../H:directoryto.svelte-kit/output/server/manifest.js"

.svelte-kit/firebase/entry.js:2:23:
  2 │ import {manifest} from '../H:\directory\to/output/server/manifest.js';
    ╵                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Build failed with 2 errors:
.svelte-kit/firebase/entry.js:1:21: ERROR: Could not resolve "../H:directoryto.svelte-kit/output/server/index.js"
.svelte-kit/firebase/entry.js:2:23: ERROR: Could not resolve "../H:directoryto.svelte-kit/output/server/manifest.js"
`

And in the entry.js file in .svelte-kit/firebase. the first two lines for the imports for Server and manifest the paths are incorrectly formed.

Steps to Reproduce

  1. Run npm run build on project
  2. Notice that after vite transform is finished, the build fails.

Expected Behaviour

When building the project with the firebase adapter, the build completes.

svelte-adapter-firebase version

0.14.0

sveltejs/kit version

1.0.0-next.334

Apologies for this, I don't have a Windows machine to test on. What's the best way to reach out to you to test a new build?

That looks like an issue with

const relativePath = path.posix.relative(dirs.tmp, builder.getServerDirectory());

from index.js

Or, more specifically, from dirs.tmp from line 37

tmp: path.join('.svelte-kit', 'firebase'),

@Nushio Discord is probably easiest. My discord username is my Github username with #6301

@Nushio Discord is probably easiest. My discord username is my Github username with #6301

Sent an FR. I'm my username #4570

In future I want to run the e2e test suite on Windows inside GitHub Actions. I believe this is possible now.