-
Notifications
You must be signed in to change notification settings - Fork 691
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix wrangler dev --local
and its lazy imports of @miniflare/tre
#2339
Conversation
🦋 Changeset detectedLatest commit: 7d27528 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
A wrangler prerelease is available for testing. You can install this latest build in your project with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/runs/3628661494/npm-package-wrangler-2339 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/prs/2339/npm-package-wrangler-2339 Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/runs/3628661494/npm-package-wrangler-2339 dev path/to/script.js Additional artifacts:npm install https://prerelease-registry.devprod.cloudflare.dev/runs/3628661494/npm-package-cloudflare-pages-shared-2339 |
Codecov Report
@@ Coverage Diff @@
## main #2339 +/- ##
==========================================
+ Coverage 70.78% 70.82% +0.03%
==========================================
Files 152 152
Lines 9712 9711 -1
Branches 2536 2536
==========================================
+ Hits 6875 6878 +3
+ Misses 2837 2833 -4
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrangler dev --local
works now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! We'll want to add a test that actually installs from an npm
registry to prevent these types of the bug in the future, but that shouldn't block releasing this.
await readyPromise; | ||
await new Promise((resolve, reject) => { | ||
wranglerProcess.once("exit", (code) => { | ||
if (!code) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: code
will be null
if the process is terminated with a signal
, in which case we'd want to reject.
if (!code) { | |
if (code === 0) { |
afterAll(async () => { | ||
await readyPromise; | ||
await new Promise((resolve, reject) => { | ||
wranglerProcess.once("exit", (code) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not required, but you might want to consider using the once
helper from node:events
here.
|
The
await import()
of the environment polyfills seemed to break out of theif (tre) {}
check. This made theminiflare-cli
dist look like:When the
@miniflare/tre
package was missing, this brokewrangler dev --local
for users.By wrapping the polyfill logic in a function like this, we can avoid this top-level import.