-
Notifications
You must be signed in to change notification settings - Fork 746
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
Add support for node:*
imports with the nodejs_compat
compatibility flag
#2539
Conversation
🦋 Changeset detectedLatest commit: 2e81412 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
7d4c231
to
ab63043
Compare
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/4283766141/npm-package-wrangler-2539 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/2539/npm-package-wrangler-2539 Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/4283766141/npm-package-wrangler-2539 dev path/to/script.js Additional artifacts:npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/4283766141/npm-package-cloudflare-pages-shared-2539 Note that these links will no longer work once the GitHub Actions artifact expires. |
Codecov Report
@@ Coverage Diff @@
## main #2539 +/- ##
==========================================
+ Coverage 73.97% 74.02% +0.05%
==========================================
Files 166 166
Lines 10163 10191 +28
Branches 2705 2722 +17
==========================================
+ Hits 7518 7544 +26
- Misses 2645 2647 +2
|
d9742f2
to
8f12780
Compare
We need to add support for this compatibility flag in Miniflare (cloudflare/miniflare#473) but once the workerd PR is merged and released, this'll be available with |
8f12780
to
721604f
Compare
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.
Could we get tests for preventing users from running the legacy flag and the runtime flag together?
Correct, I would like to see tests for that as a proof/coverage of that check functionality. Edit: I apologize, my wording was ambiguous. |
What is the status of this PR? Currently I get this error when trying to use it: Is this PR related / will enable this workerd PR: cloudflare/workerd#208 ? |
@danbars , still a work-in-progress! Please bear with us. |
Hi @GregBrimble, sorry for nagging, I simply have a module that is pending on this PR - using |
1b3943e
to
bb6e459
Compare
@JacobMGEvans: rebased and added a couple of tests for that now: |
52cb6d3
to
97b4201
Compare
97b4201
to
c907da9
Compare
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 great. I like the "conjunction" messaging and I appreciate the tests around trying to use them together.
…ty flag (#2539) * Fix capitalization of Node.js * Internally rename `nodeCompat` to `legacyNodeCompat` * Mark `node:*` imports as external when using the `nodejs_compat` compatibility flag
Should this work with Pages? See https://discord.com/channels/595317990191398933/1024343493251973190/1084637493787373630 |
What this PR solves / how to test:
This PR does two things:
--node-compat
CLI/config option internally tolegacyNodeCompat
. Nothing changes externally. You still invoke it with--node-compat
ornode_compat
. We maybe want to think about moving this toexperimental
as we stabilize thedev()
API, but that discussion can happen elsewhere.node:
as external when bundling with thenodejs_compat
compatibility flag.Associated docs issues/PR:
nodejs_compat
Compatibility Flag miniflare#473Author has included the following, where applicable:
publish --dry-run
andpages functions build
output)Reviewer has performed the following, where applicable:
Fixes # [insert issue number].