Skip to content

Commit

Permalink
fix: add workerd to esbuild conditions (#12069)
Browse files Browse the repository at this point in the history
* fix: add `workerd` condition to cloudflare worker build

* Update packages/adapter-cloudflare/index.js

Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>

* Update packages/adapter-cloudflare-workers/index.js

Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>

* Update .changeset/popular-chairs-pull.md

---------

Co-authored-by: Tee Ming <chewteeming01@gmail.com>
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
  • Loading branch information
3 people authored Apr 3, 2024
1 parent d3a9095 commit df6641a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changeset/popular-chairs-pull.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@sveltejs/adapter-cloudflare-workers": patch
"@sveltejs/adapter-cloudflare": patch
---

fix: add `workerd` to esbuild conditions
3 changes: 2 additions & 1 deletion packages/adapter-cloudflare-workers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ export default function ({ config = 'wrangler.toml' } = {}) {
try {
const result = await esbuild.build({
platform: 'browser',
conditions: ['worker', 'browser'],
// https://github.com/cloudflare/workers-sdk/blob/a12b2786ce745f24475174bcec994ad691e65b0f/packages/wrangler/src/deployment-bundle/bundle.ts#L35-L36
conditions: ['workerd', 'worker', 'browser'],
sourcemap: 'linked',
target: 'es2022',
entryPoints: [`${tmp}/entry.js`],
Expand Down
3 changes: 2 additions & 1 deletion packages/adapter-cloudflare/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ export default function (options = {}) {
try {
const result = await esbuild.build({
platform: 'browser',
conditions: ['worker', 'browser'],
// https://github.com/cloudflare/workers-sdk/blob/a12b2786ce745f24475174bcec994ad691e65b0f/packages/wrangler/src/deployment-bundle/bundle.ts#L35-L36
conditions: ['workerd', 'worker', 'browser'],
sourcemap: 'linked',
target: 'es2022',
entryPoints: [`${tmp}/_worker.js`],
Expand Down

0 comments on commit df6641a

Please sign in to comment.