-
Notifications
You must be signed in to change notification settings - Fork 776
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: avoid injecting esbuild watch stubs into production Worker code (#…
…5960) When we added the ability to include additional modules in the deployed bundle of a Worker, we inadvertently also included some boiler plate code that is only needed at development time. This fix ensures that this code is only injected if we are running esbuild in watch mode (e.g. `wrangler dev`) and not when building for deployment. It is interesting to note that this boilerplate only gets included in the production code if there is an import of CommonJS code in the Worker, which esbuild needs to convert to an ESM import. Fixes [#4269](#4269)
- Loading branch information
1 parent
6a4f20d
commit e648825
Showing
4 changed files
with
44 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
"wrangler": patch | ||
--- | ||
|
||
fix: avoid injecting esbuild watch stubs into production Worker code | ||
|
||
When we added the ability to include additional modules in the deployed bundle of a Worker, | ||
we inadvertently also included some boiler plate code that is only needed at development time. | ||
|
||
This fix ensures that this code is only injected if we are running esbuild in watch mode | ||
(e.g. `wrangler dev`) and not when building for deployment. | ||
|
||
It is interesting to note that this boilerplate only gets included in the production code | ||
if there is an import of CommonJS code in the Worker, which esbuild needs to convert to an | ||
ESM import. | ||
|
||
Fixes [#4269](https://github.com/cloudflare/workers-sdk/issues/4269) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters