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

*DUPLICATE* [wrangler] Use esbuild-plugins-node-modules-polyfill for Node.js polyfills instead of @esbuild-plugins #4902

Closed
wants to merge 1 commit into from

Conversation

rnmeow
Copy link

@rnmeow rnmeow commented Feb 2, 2024

What this PR solves / how to test:

Removes dependency @esbuild-plugins/node-globals-polyfill and @esbuild-plugins/node-modules-polyfill since they're both out-of-date.

Adds dependency esbuild-plugin-polyfill-node for support of Node.js polyfills.

This is probably not needed to test, without breaking changes, I think.

Author has addressed the following:

  • Tests
    • Included
    • Not necessary because: Unrelated.
  • Changeset (Changeset guidelines)
    • Included
    • Not necessary because:
  • Associated docs
    • Issue(s)/PR(s):
    • Not necessary because: Unrelated.

Copy link

changeset-bot bot commented Feb 2, 2024

🦋 Changeset detected

Latest commit: 7488a42

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

@rnmeow rnmeow marked this pull request as ready for review February 2, 2024 10:33
@rnmeow rnmeow requested a review from a team as a code owner February 2, 2024 10:33
@rnmeow rnmeow changed the title [wrangler] refactor: use esbuild-plugins-node-modules-polyfill inst… [wrangler] refactor: use esbuild-plugins-node-modules-polyfill instead of @esbuild-plugins Feb 2, 2024
@rnmeow rnmeow changed the title [wrangler] refactor: use esbuild-plugins-node-modules-polyfill instead of @esbuild-plugins [wrangler] Use esbuild-plugins-node-modules-polyfill for polyfills instead of @esbuild-plugins Feb 4, 2024
@rnmeow rnmeow changed the title [wrangler] Use esbuild-plugins-node-modules-polyfill for polyfills instead of @esbuild-plugins [wrangler] Use esbuild-plugins-node-modules-polyfill for Node.js polyfills instead of @esbuild-plugins Feb 4, 2024
Copy link
Contributor

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

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

Let me see if I can get the CI checks running on this...

.changeset/rare-bananas-add.md Outdated Show resolved Hide resolved
.changeset/rare-bananas-add.md Outdated Show resolved Hide resolved
Copy link
Contributor

github-actions bot commented Feb 5, 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/7783226811/npm-package-wrangler-4902

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

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

Or you can use npx with this latest build directly:

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

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


[email protected] includes the following runtime dependencies:

Package Constraint Resolved
miniflare workspace:* 3.20240129.0
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.

@petebacondarwin
Copy link
Contributor

I can't push a fixup commit to your PR as you did not allow contributors to update your branch.
But you need to fix the formatting with this diff:

diff --git a/packages/wrangler/src/deployment-bundle/bundle.ts b/packages/wrangler/src/deployment-bundle/bundle.ts
index dab86a06..cd7b0db9 100644
--- a/packages/wrangler/src/deployment-bundle/bundle.ts
+++ b/packages/wrangler/src/deployment-bundle/bundle.ts
@@ -325,12 +325,14 @@ export async function bundleWorker(
                plugins: [
                        moduleCollector.plugin,
                        ...(legacyNodeCompat
-                               ? [nodeModulesPolyfillPlugin({
-                                               globals: {
-                                                       process: true,
-                                                       Buffer: true,
-                                               },
-                                       })]
+                               ? [
+                                               nodeModulesPolyfillPlugin({
+                                                       globals: {
+                                                               process: true,
+                                                               Buffer: true,
+                                                       },
+                                               }),
+                                 ]
                                : []),
                        ...(nodejsCompat ? [nodejsCompatPlugin] : []),
                        cloudflareInternalPlugin,

You can fix this via the command line by running pnpm fix in the root of the monorepo.

Copy link

codecov bot commented Feb 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (3cb2a8a) 70.64% compared to head (f7c91ef) 70.61%.
Report is 8 commits behind head on main.

❗ Current head f7c91ef differs from pull request most recent head 7488a42. Consider uploading reports for the commit 7488a42 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4902      +/-   ##
==========================================
- Coverage   70.64%   70.61%   -0.04%     
==========================================
  Files         292      292              
  Lines       15183    15186       +3     
  Branches     3863     3865       +2     
==========================================
- Hits        10726    10723       -3     
- Misses       4457     4463       +6     
Files Coverage Δ
packages/wrangler/src/deployment-bundle/bundle.ts 87.82% <100.00%> (-0.11%) ⬇️

... and 3 files with indirect coverage changes

@petebacondarwin
Copy link
Contributor

I'm a bit concerned about these issues with the proposed package:

I think we need to check that these do not impair Wrangler before we can merge this.

…lyfill-node`

See remorses/esbuild-plugins#41 for more information about the deprecated packages.
@rnmeow
Copy link
Author

rnmeow commented Feb 5, 2024

I'm a bit concerned about these issues with the proposed package:
...
I think we need to check that these do not impair Wrangler before we can merge this.

At a glance, the problems seem to appear at Vite-side and old Node.js runtimes. However, to examine a little bit more will be safer (especially for the users).

@mrbbot
Copy link
Contributor

mrbbot commented Feb 5, 2024

I believe this is duplicate of #3832. Per #3832 (comment), we believe this would be a breaking change and as such need to wait until the next major release before we can land this. In the meantime, we recommend using Custom builds if you need additional polyfills.

@rnmeow rnmeow changed the title [wrangler] Use esbuild-plugins-node-modules-polyfill for Node.js polyfills instead of @esbuild-plugins *DUPLICATE* [wrangler] Use esbuild-plugins-node-modules-polyfill for Node.js polyfills instead of @esbuild-plugins Feb 5, 2024
@rnmeow
Copy link
Author

rnmeow commented Feb 5, 2024

I believe this is duplicate of #3832. Per #3832 (comment) ...

Closing.

PS. It's surprising that to deprecate the packages is such a breaking change.

@rnmeow rnmeow closed this Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants