Skip to content

fix(vite-plugin): ensure node compat globals are injected before any imports#9581

Merged
petebacondarwin merged 3 commits intomainfrom
pbd/vite-plugin/fix-node-compat-global-injection
Jun 12, 2025
Merged

fix(vite-plugin): ensure node compat globals are injected before any imports#9581
petebacondarwin merged 3 commits intomainfrom
pbd/vite-plugin/fix-node-compat-global-injection

Conversation

@petebacondarwin
Copy link
Copy Markdown
Contributor

Fixes #9562


  • Tests
    • TODO (before merge)
    • Tests included
    • Tests not necessary because:
  • Wrangler / Vite E2E Tests CI Job required? (Use "e2e" label or ask maintainer to run separately)
    • I don't know
    • Required
    • Not required because: covered by other tests
  • Public documentation
    • TODO (before merge)
    • Cloudflare docs PR(s):
    • Documentation not necessary because: bug fix
  • Wrangler V3 Backport
    • TODO (before merge)
    • Wrangler PR:
    • Not necessary because: vite-plugin is not backported

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Jun 12, 2025

🦋 Changeset detected

Latest commit: 0fee5c6

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

This PR includes changesets to release 1 package
Name Type
@cloudflare/vite-plugin 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

@github-project-automation github-project-automation bot moved this to Untriaged in workers-sdk Jun 12, 2025
@petebacondarwin petebacondarwin marked this pull request as ready for review June 12, 2025 14:32
@petebacondarwin petebacondarwin requested a review from a team June 12, 2025 14:32
@petebacondarwin petebacondarwin requested a review from a team as a code owner June 12, 2025 14:32
@petebacondarwin petebacondarwin force-pushed the pbd/vite-plugin/fix-node-compat-global-injection branch 2 times, most recently from bfa97b7 to 48c8d44 Compare June 12, 2025 14:35
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Jun 12, 2025

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@9581

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@9581

miniflare

npm i https://pkg.pr.new/miniflare@9581

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@9581

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@9581

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@9581

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@9581

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@9581

wrangler

npm i https://pkg.pr.new/wrangler@9581

commit: 0fee5c6

@petebacondarwin petebacondarwin force-pushed the pbd/vite-plugin/fix-node-compat-global-injection branch 3 times, most recently from fdf423f to f664365 Compare June 12, 2025 14:49
@petebacondarwin petebacondarwin added e2e Run wrangler + vite-plugin e2e tests on a PR c3-e2e Run c3 e2e tests on a PR every-os labels Jun 12, 2025
Copy link
Copy Markdown
Contributor

@threepointone threepointone left a comment

Choose a reason for hiding this comment

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

this is great, thank you!

Comment on lines 136 to 138
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

awesome

Copy link
Copy Markdown
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

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

LGTM with 2 nits

@github-project-automation github-project-automation bot moved this from Untriaged to Approved in workers-sdk Jun 12, 2025
@petebacondarwin
Copy link
Copy Markdown
Contributor Author

Checked manually that it works against the original reproduction.

petebacondarwin and others added 3 commits June 12, 2025 16:38
Co-authored-by: Victor Berchet <victor@suumit.com>
@petebacondarwin petebacondarwin force-pushed the pbd/vite-plugin/fix-node-compat-global-injection branch from ab30f6f to 0fee5c6 Compare June 12, 2025 15:38
@petebacondarwin petebacondarwin added this pull request to the merge queue Jun 12, 2025
Merged via the queue into main with commit 6bc0a2f Jun 12, 2025
26 checks passed
@petebacondarwin petebacondarwin deleted the pbd/vite-plugin/fix-node-compat-global-injection branch June 12, 2025 17:16
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Jun 12, 2025
jseba added a commit to jseba/workers-sdk that referenced this pull request Jun 14, 2025
* 'main' of ssh://github.com/cloudflare/workers-sdk: (213 commits)
  fix(vite-plugin-cloudflare): allow unknown entrypoint on startup (cloudflare#9583)
  add warning about env not specified to potentially risky wrangler commands (cloudflare#9344)
  test: correctly delete test d1 databases (cloudflare#9598)
  Add details to v3 maintenance worflow error message (cloudflare#9602)
  drop unused `WRANGLER_UNENV_RESOLVE_PATHS` env var (cloudflare#9593)
  warn instead of erroring if no exposed ports. and remove unused dev_exposed_ports (cloudflare#9573)
  fix(wrangler): point to the right doc location (replaces cloudflare#9353) (cloudflare#9592)
  [vitest-pool-worker] Add `type: module` in package.json (cloudflare#9595)
  Enable HTML handling for HTML files in the public directory (cloudflare#9548)
  switch from go container to js (cloudflare#9588)
  containers: switch to Cloudflare container registry (cloudflare#9564)
  performance improvement: restart a mixed mode session only if the worker's remote bindings have changed (cloudflare#9536)
  ci: delete more orphaned resources from e2e tests (cloudflare#9580)
  test: remove `verifyBuildScript` logic from c3 e2e tests (cloudflare#9504)
  fix(vite-plugin): ensure node compat globals are injected before any imports (cloudflare#9581)
  feat(containers-shared): Move `isDockerfile` utility function to `containers-shared` (cloudflare#9577)
  allow `startWorker` to accept `false` as an `inspector` option (to disable the inspector server) (cloudflare#9550)
  Update capnp generated code from the workerd.capnp (cloudflare#9582)
  Bump `@cloudflare/unenv-preset` to 2.3.3 (cloudflare#9566)
  test: make custom build bundling tests more robust (cloudflare#9494)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c3-e2e Run c3 e2e tests on a PR e2e Run wrangler + vite-plugin e2e tests on a PR

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

the vite plugin applies unenv polyfills in the wrong order

4 participants