From a34370c14af0179b0194deae3050330379cf138d Mon Sep 17 00:00:00 2001 From: Hydrophobefireman Date: Tue, 4 Jan 2022 16:58:47 +0530 Subject: [PATCH] [adapter-vercel] Use path/posix to resolve the relative path (issue#3163) (#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 https://github.com/sveltejs/kit/issues/3163 ) * use posix as export instead of subpackage * Add changeset * Update .changeset/fuzzy-jobs-retire.md Co-authored-by: Ignatius Bagus Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com> Co-authored-by: Ignatius Bagus --- .changeset/fuzzy-jobs-retire.md | 5 +++++ packages/adapter-vercel/index.js | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/fuzzy-jobs-retire.md diff --git a/.changeset/fuzzy-jobs-retire.md b/.changeset/fuzzy-jobs-retire.md new file mode 100644 index 000000000000..c603ce909536 --- /dev/null +++ b/.changeset/fuzzy-jobs-retire.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/adapter-vercel': patch +--- + +Use path.posix to resolve routes for esmodules diff --git a/packages/adapter-vercel/index.js b/packages/adapter-vercel/index.js index 069a6d02146f..f18a5ad74efb 100644 --- a/packages/adapter-vercel/index.js +++ b/packages/adapter-vercel/index.js @@ -1,5 +1,5 @@ import { writeFileSync } from 'fs'; -import { relative } from 'path'; +import { posix } from 'path'; import { fileURLToPath } from 'url'; import esbuild from 'esbuild'; @@ -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: {