Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[adapter-vercel] Build fails - path to bundle not being correctly outputted on Windows? #3163

Closed
CobyPear opened this issue Dec 31, 2021 · 10 comments
Labels
bug Something isn't working p2-nice-to-have SvelteKit cannot be used by a small number of people, quality of life improvements, etc. pkg:adapter-vercel Pertaining to the Vercel adapter windows

Comments

@CobyPear
Copy link

Describe the bug

  1. run npm run build on SvelteKit project (was working fine before updating vercel-adapter)

ER: Project builds successfully
AR: The following errors:

> Using @sveltejs/adapter-vercel
 > .svelte-kit/vercel-tmp/entry.js:3:20: error: Could not resolve "..outputserver/app.js" (mark it as external to exclude it from the bundle)
    3 │ import { App } from '..\output\server/app.js';
      ╵                     ~~~~~~~~~~~~~~~~~~~~~~~~~

 > .svelte-kit/vercel-tmp/manifest.js:8:16: error: Could not resolve "..outputserver/nodes/0.js" (mark it as external to exclude it from the bundle, or add ".catch()" to handle the failure at run-time)
    8 │       () => import('..\output\server/nodes/0.js'),
      ╵                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 > .svelte-kit/vercel-tmp/manifest.js:9:16: error: Could not resolve "..outputserver/nodes/1.js" (mark it as external to exclude it from the bundle, or add ".catch()" to handle the failure at run-time)
    9 │       () => import('..\output\server/nodes/1.js'),
      ╵                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 > .svelte-kit/vercel-tmp/manifest.js:10:16: error: Could not resolve "..outputserver/nodes/4.js" (mark it as external to exclude it from the bundle, or add ".catch()" to handle the failure at run-time)
    10 │       () => import('..\output\server/nodes/4.js'),
       ╵                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 > .svelte-kit/vercel-tmp/manifest.js:11:16: error: Could not resolve "..outputserver/nodes/5.js" (mark it as external to exclude it from the bundle, or add ".catch()" to handle the failure at run-time)
    11 │       () => import('..\output\server/nodes/5.js')
       ╵                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Note the paths have forward slashes and the error path seems wrong > ..outputserver instead of ..\output\server, looks like \ is not being escaped properly perhaps? This would only show up on Windows and iirc no Svelte maintainers use Windows??

I would love to submit a PR but would need some guidance.

Reproduction

https://github.com/CobyPear/adapter-vercel-repro

clone the repo, npm i and npm run build should show the following errors in the console (on WIndows 11, will check Ubuntu if I have time):

> .svelte-kit/vercel-tmp/entry.js:3:20: error: Could not resolve "..outputserver/app.js" (mark it as external to exclude it from the bundle)
   3 │ import { App } from '..\output\server/app.js';
     ╵                     ~~~~~~~~~~~~~~~~~~~~~~~~~

> .svelte-kit/vercel-tmp/manifest.js:8:16: error: Could not resolve "..outputserver/nodes/0.js" (mark it as external to exclude it from the bundle, or add ".catch()" to handle the failure at run-time)
   8 │       () => import('..\output\server/nodes/0.js'),
     ╵                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

> .svelte-kit/vercel-tmp/manifest.js:9:16: error: Could not resolve "..outputserver/nodes/1.js" (mark it as external to exclude it from the bundle, or add ".catch()" to handle the failure at run-time)
   9 │       () => import('..\output\server/nodes/1.js'),
     ╵                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

> .svelte-kit/vercel-tmp/manifest.js:10:16: error: Could not resolve "..outputserver/nodes/2.js" (mark it as external to exclude it from the bundle, or add ".catch()" to handle the failure at run-time)
   10 │       () => import('..\output\server/nodes/2.js')
      ╵                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   ```

### Logs

_No response_

### System Info

```shell
for the reproduction project:

System:
   OS: Windows 10 10.0.22000
   CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
   Memory: 4.96 GB / 15.89 GB
 Binaries:
   Node: 16.8.0 - C:\Program Files\nodejs\node.EXE
   Yarn: 1.22.17 - C:\Program Files\nodejs\yarn.CMD
   npm: 7.21.0 - C:\Program Files\nodejs\npm.CMD
 Browsers:
   Chrome: 96.0.4664.110
   Edge: Spartan (44.22000.120.0), Chromium (96.0.1054.62)
   Internet Explorer: 11.0.22000.120
 npmPackages:
   @sveltejs/adapter-auto: next => 1.0.0-next.7
   @sveltejs/adapter-vercel: next => 1.0.0-next.34
   @sveltejs/kit: next => 1.0.0-next.211
   svelte: ^3.44.0 => 3.44.3

Not sure how accurate that is. I'm on Windows 11

Severity

blocking an upgrade

Additional Information

Not sure how to work around this at the moment, any help is much appreciated :)

@CobyPear
Copy link
Author

As expected this works fine on Ubuntu. Something to do with path.relative in the new builder API is not friendly to windows.

@bluwy bluwy added bug Something isn't working p3-edge-case SvelteKit cannot be used in an uncommon way pkg:adapter-vercel Pertaining to the Vercel adapter labels Jan 1, 2022
@benmccann benmccann added windows p2-nice-to-have SvelteKit cannot be used by a small number of people, quality of life improvements, etc. and removed p3-edge-case SvelteKit cannot be used in an uncommon way labels Jan 2, 2022
Rich-Harris pushed a commit that referenced this issue Jan 4, 2022
…163) (#3200)

* Use path/posix to resolve the relative path

if we use the default path implementation, on windows we get malformed output since esmodules use "/" as the seperator

(related #3163 )

* use posix as export instead of subpackage

* Add changeset

* Update .changeset/fuzzy-jobs-retire.md

Co-authored-by: Ignatius Bagus <ignatius.mbs@gmail.com>

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Ignatius Bagus <ignatius.mbs@gmail.com>
@geoffrich
Copy link
Member

Is this resolved by the linked PR?

@ignatiusmb
Copy link
Member

It should be resolved in the latest version (1.0.0-next.35)

@Nuckerr
Copy link

Nuckerr commented Feb 26, 2022

So I deployed my svelte-kit project to vercel and got this exact same error. It builds fine on my windows pc

@ohbob
Copy link

ohbob commented Feb 27, 2022

same error on vercel, builds fine on manjaro.

@Scientist-Ansh
Copy link

Same error

@maxgraze-zz
Copy link

same error on vercel. I am using a mac.

@gpaiva985
Copy link

same error here.
using a mac.

@gpaiva985
Copy link

same error here. using a mac.

update: I just run "npm update" and works fine

@maxgraze-zz
Copy link

Yup updating npm worked for me. Thanks @gpaiva985 !

@sveltejs sveltejs locked as resolved and limited conversation to collaborators Mar 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working p2-nice-to-have SvelteKit cannot be used by a small number of people, quality of life improvements, etc. pkg:adapter-vercel Pertaining to the Vercel adapter windows
Projects
None yet
Development

No branches or pull requests

10 participants