Skip to content

Commit

Permalink
[adapter-vercel] Use path/posix to resolve the relative path (issue#3…
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
3 people authored Jan 4, 2022
1 parent 2839689 commit a34370c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/fuzzy-jobs-retire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/adapter-vercel': patch
---

Use path.posix to resolve routes for esmodules
4 changes: 2 additions & 2 deletions packages/adapter-vercel/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { writeFileSync } from 'fs';
import { relative } from 'path';
import { posix } from 'path';
import { fileURLToPath } from 'url';
import esbuild from 'esbuild';

Expand Down Expand Up @@ -31,7 +31,7 @@ export default function () {

builder.log.minor('Generating serverless function...');

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

builder.copy(files, tmp, {
replace: {
Expand Down

0 comments on commit a34370c

Please sign in to comment.