Skip to content
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: ensure worker reloads when importing node:* modules #4962

Merged
merged 3 commits into from
Feb 9, 2024

Conversation

mrbbot
Copy link
Contributor

@mrbbot mrbbot commented Feb 9, 2024

Fixes #4959.

What this PR solves / how to test:

#4499 introduced a bug which prevented reloads when importing node:* modules. The internal per-build seen cache was not cleared between builds, resulting in this branch being hit...

...and the resolution failing. This change wraps that in an onStart(), so it's called at the start of each build, and also moves the caches inside the plugin, so multiple instances of the plugin can be created.

To test this, follow the reproduction instructions in #4959, no errors should be reported.

Author has addressed the following:

  • Tests
    • Included
    • Not necessary because:
  • Changeset (Changeset guidelines)
    • Included
    • Not necessary because:
  • Associated docs
    • Issue(s)/PR(s):
    • Not necessary because: fixing a regression

Note for PR author:

We want to celebrate and highlight awesome PR review! If you think this PR received a particularly high-caliber review, please assign it the label highlight pr review so future reviewers can take inspiration and learn from it.

@mrbbot mrbbot requested a review from a team as a code owner February 9, 2024 10:36
Copy link

changeset-bot bot commented Feb 9, 2024

🦋 Changeset detected

Latest commit: a692499

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
wrangler Patch

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

@mrbbot mrbbot added the e2e Run e2e tests on a PR label Feb 9, 2024
Copy link
Contributor

github-actions bot commented Feb 9, 2024

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/workers-sdk/runs/7842962110/npm-package-wrangler-4962

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/4962/npm-package-wrangler-4962

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7842962110/npm-package-wrangler-4962 dev path/to/script.js
Additional artifacts:
npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7842962110/npm-package-create-cloudflare-4962 --no-auto-update
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7842962110/npm-package-miniflare-4962
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7842962110/npm-package-cloudflare-pages-shared-4962

Note that these links will no longer work once the GitHub Actions artifact expires.


wrangler@3.28.0 includes the following runtime dependencies:

Package Constraint Resolved
miniflare workspace:* 3.20240129.1
workerd 1.20240129.0 1.20240129.0
workerd --version 1.20240129.0 2024-01-29

Please ensure constraints are pinned, and miniflare/workerd minor versions match.

Copy link
Contributor

@penalosa penalosa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this!

Copy link

codecov bot commented Feb 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (ffafe8a) 70.43% compared to head (a692499) 70.45%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4962      +/-   ##
==========================================
+ Coverage   70.43%   70.45%   +0.02%     
==========================================
  Files         295      295              
  Lines       15407    15409       +2     
  Branches     3948     3948              
==========================================
+ Hits        10852    10857       +5     
+ Misses       4555     4552       -3     
Files Coverage Δ
...deployment-bundle/esbuild-plugins/nodejs-compat.ts 96.87% <100.00%> (+6.55%) ⬆️
packages/wrangler/src/navigator-user-agent.ts 100.00% <100.00%> (ø)

... and 4 files with indirect coverage changes

@mrbbot mrbbot merged commit d658517 into main Feb 9, 2024
19 checks passed
@mrbbot mrbbot deleted the bcoll/fix-node-reloads branch February 9, 2024 11:25
@workers-devprod workers-devprod mentioned this pull request Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e2e Run e2e tests on a PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 BUG: Crashes on reload if using node:xxx imports
2 participants