diff --git a/.changeset/many-papayas-invite.md b/.changeset/many-papayas-invite.md new file mode 100644 index 000000000000..d37181953282 --- /dev/null +++ b/.changeset/many-papayas-invite.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/adapter-cloudflare-workers': patch +--- + +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..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'; +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: {