From ee70059fec39204c17dcd5d74366bd60f56fe2d6 Mon Sep 17 00:00:00 2001 From: Hyunbin <47051820+hyunbinseo@users.noreply.github.com> Date: Wed, 5 Jan 2022 11:19:49 +0900 Subject: [PATCH 1/3] fix: use path/posix to resolve relative paths --- .changeset/many-papayas-invite.md | 5 +++++ packages/adapter-cloudflare-workers/index.js | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/many-papayas-invite.md diff --git a/.changeset/many-papayas-invite.md b/.changeset/many-papayas-invite.md new file mode 100644 index 000000000000..04c4bbe97862 --- /dev/null +++ b/.changeset/many-papayas-invite.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/adapter-cloudflare-workers': minor +--- + +use path/posix to resolve relative paths for esmodules diff --git a/packages/adapter-cloudflare-workers/index.js b/packages/adapter-cloudflare-workers/index.js index b58907fc979c..ba243facbe75 100644 --- a/packages/adapter-cloudflare-workers/index.js +++ b/packages/adapter-cloudflare-workers/index.js @@ -1,5 +1,5 @@ import { existsSync, readFileSync, writeFileSync } from 'fs'; -import { relative } from 'path'; +import { relative } from 'path/posix'; import { execSync } from 'child_process'; import esbuild from 'esbuild'; import toml from '@iarna/toml'; From 2da3078c3cadbcdaf3427c5cdc4f187a720ede4a Mon Sep 17 00:00:00 2001 From: Ignatius Bagus Date: Wed, 5 Jan 2022 09:41:14 +0700 Subject: [PATCH 2/3] Update .changeset/many-papayas-invite.md --- .changeset/many-papayas-invite.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/many-papayas-invite.md b/.changeset/many-papayas-invite.md index 04c4bbe97862..d37181953282 100644 --- a/.changeset/many-papayas-invite.md +++ b/.changeset/many-papayas-invite.md @@ -1,5 +1,5 @@ --- -'@sveltejs/adapter-cloudflare-workers': minor +'@sveltejs/adapter-cloudflare-workers': patch --- use path/posix to resolve relative paths for esmodules From d64f101360bca88e3313f9035baddd17a288b57c Mon Sep 17 00:00:00 2001 From: Hyunbin <47051820+hyunbinseo@users.noreply.github.com> Date: Wed, 5 Jan 2022 12:03:10 +0900 Subject: [PATCH 3/3] fix: use posix.relative instead of path/posix https://github.com/sveltejs/kit/pull/3212#issuecomment-1005329365 --- packages/adapter-cloudflare-workers/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/adapter-cloudflare-workers/index.js b/packages/adapter-cloudflare-workers/index.js index ba243facbe75..ae1e73b40731 100644 --- a/packages/adapter-cloudflare-workers/index.js +++ b/packages/adapter-cloudflare-workers/index.js @@ -1,5 +1,5 @@ import { existsSync, readFileSync, writeFileSync } from 'fs'; -import { relative } from 'path/posix'; +import { posix } from 'path'; import { execSync } from 'child_process'; import esbuild from 'esbuild'; import toml from '@iarna/toml'; @@ -35,7 +35,7 @@ export default function () { builder.log.info(stdout.toString()); builder.log.minor('Generating worker...'); - const relativePath = relative(tmp, builder.getServerDirectory()); + const relativePath = posix.relative(tmp, builder.getServerDirectory()); builder.copy(`${files}/entry.js`, `${tmp}/entry.js`, { replace: {