Skip to content

Commit

Permalink
feat(build): configure esbuild to prefer cloudflare-worker then worke…
Browse files Browse the repository at this point in the history
…r package export conditionals if available
  • Loading branch information
nicksrandall committed Dec 13, 2021
1 parent bcb29aa commit a414ea7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/wrangler/src/dev.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,13 @@ function useEsbuild(props: {
...(jsxFactory && { jsxFactory }),
...(jsxFragment && { jsxFragment }),
external: ["__STATIC_CONTENT_MANIFEST"],
conditions: [
"cloudflare-worker",
"worker",
"browser",
"module",
"default",
],
// TODO: import.meta.url
watch: {
async onRebuild(error) {
Expand Down
1 change: 1 addition & 0 deletions packages/wrangler/src/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export default async function publish(props: Props): Promise<void> {
: undefined,
sourcemap: true,
metafile: true,
conditions: ["cloudflare-worker", "worker", "browser", "module", "default"],
loader: {
".js": "jsx",
},
Expand Down

0 comments on commit a414ea7

Please sign in to comment.