Commit 0dfd955
authored
fix: ensure that pg-cloudflare can be used with bundlers that don't know 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$/, }), ], ```1 parent 20d2c08 commit 0dfd955
2 files changed
+8
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
12 | 16 | | |
13 | 17 | | |
14 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
0 commit comments