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

Remove the node protocol from the require statement #250

Merged
merged 4 commits into from
May 2, 2024

Conversation

aron
Copy link
Contributor

@aron aron commented May 2, 2024

This should improve the situation for certain JavaScript bundlers in the ecosystem which do not like the node:crypto require statement, see #225 and #243.

@aron
Copy link
Contributor Author

aron commented May 2, 2024

Urgh, this is probably a no-go too, if we remove the node: prefix we break Cloudflare:

✘ [ERROR] Could not resolve "crypto"

    ../../lib/util.js:95:21:
      95 │     crypto = require("crypto").webcrypto;
         ╵                      ~~~~~~~~

  The package "crypto" wasn't found on the file system but is built into node.
  Add "node_compat = true" to your wrangler.toml file and make sure to prefix the module name with "node:" to enable Node.js compatibility.

@aron aron force-pushed the fix/require-node-crypto-bundler-error branch 2 times, most recently from ab30893 to 2e68c8d Compare May 2, 2024 13:35
@@ -0,0 +1,14 @@
{
"name": "replicate-next",
Copy link
Member

Choose a reason for hiding this comment

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

@aron Thanks for taking the time to add an integration test for Next.js!

Copy link
Member

@mattt mattt left a comment

Choose a reason for hiding this comment

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

I love this. Thanks so much for your work on this. Here's hoping that this will resolve the issues folks were having with standard library imports.

@mattt mattt force-pushed the fix/require-node-crypto-bundler-error branch from 2e68c8d to 6ae67a2 Compare May 2, 2024 21:30
@mattt mattt merged commit 587d445 into main May 2, 2024
18 checks passed
@mattt mattt deleted the fix/require-node-crypto-bundler-error branch May 2, 2024 21:32
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.

None yet

2 participants