-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 that pg-cloudflare can be used with bundlers that don't know about Cloudflare sockets #2978
Conversation
…now about Cloudflare sockets By implementing package.json `exports` we can avoid processing the Cloudflare specific code, which contains `import ... from "cloudflare:sockets"`, in bundlers such as Webpack. If you are bundling for a Worker environment using Webpack then you need to add the `workerd` condition and ignore `cloudflare:sockets` imports: **webpack.config.js** ```js resolve: { conditionNames: ["require", "node", "workerd"] }, plugins: [ new webpack.IgnorePlugin({ resourceRegExp: /^cloudflare:sockets$/, }), ], ```
@petebacondarwin you still working on this (it's set to draft) - getting repeated issues about this & I'd love to help get this one merged in. |
Oh sorry. I thought it was set to ready. |
Ah great thanks! I'll go ahead & get it released & follow up on the linked issues. ❤️ |
what about vite ? |
+1 |
@IqbalLx and/or @Feuerhamster - please could you provide a simple reproduction of a problem you have with this library and Vite so that I can debug it and find a solution. |
…now about Cloudflare sockets (brianc#2978) By implementing package.json `exports` we can avoid processing the Cloudflare specific code, which contains `import ... from "cloudflare:sockets"`, in bundlers such as Webpack. If you are bundling for a Worker environment using Webpack then you need to add the `workerd` condition and ignore `cloudflare:sockets` imports: **webpack.config.js** ```js resolve: { conditionNames: ["require", "node", "workerd"] }, plugins: [ new webpack.IgnorePlugin({ resourceRegExp: /^cloudflare:sockets$/, }), ], ```
Fixes #2975
By implementing package.json
exports
we can avoid processing the Cloudflare specific code, which containsimport ... from "cloudflare:sockets"
, in bundlers such as Webpack.If you are bundling for a Worker environment using Webpack then you need to add the
workerd
condition and ignorecloudflare:sockets
imports:webpack.config.js