Skip to content

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

Description

@CobyPear

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 :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    p2-nice-to-haveSvelteKit cannot be used by a small number of people, quality of life improvements, etc.pkg:adapter-vercelPertaining to the Vercel adapterwindows

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions