-
Notifications
You must be signed in to change notification settings - Fork 760
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: module support in service-worker format workers
This rewrites how we pass configuration to miniflare in `wrangler dev`'s local mode. Instead of passing the entire configuration as cli args, we now generate a `wrangler.toml` based on our generated/inferred configuration, and pass that to miniflare instead. This solves a couple of issues, notably - - `text_blobs` now works in local mode+service-worker format - `Text` modules now work in local mode+service-worker format - We properly throw errors for `Data` module in service-worker format Along with cloudflare/miniflare#205, this fixes #416.
- Loading branch information
1 parent
835c3ae
commit 1479888
Showing
4 changed files
with
96 additions
and
50 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,13 @@ | ||
--- | ||
"wrangler": patch | ||
--- | ||
|
||
fix: module support in service-worker format workers | ||
|
||
This rewrites how we pass configuration to miniflare in `wrangler dev`'s local mode. Instead of passing the entire configuration as cli args, we now generate a `wrangler.toml` based on our generated/inferred configuration, and pass that to miniflare instead. This solves a couple of issues, notably - | ||
|
||
- `text_blobs` now works in local mode+service-worker format | ||
- `Text` modules now work in local mode+service-worker format | ||
- We properly throw errors for `Data` module in service-worker format | ||
|
||
Along with https://github.com/cloudflare/miniflare/pull/205, this fixes https://github.com/cloudflare/wrangler2/issues/416. |
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,5 @@ | ||
import content from "./content.md"; | ||
|
||
addEventListener("fetch", (event) => { | ||
event.respondWith(new Response(`${event.request.url}: ${content}`)); | ||
}); |
Empty file.
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