mirror of
https://github.com/brianc/node-postgres.git
synced 2026-01-18 15:55:05 +00:00
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$/,
}),
],
```
4 lines
144 B
TypeScript
4 lines
144 B
TypeScript
// This is an empty module that is served up when outside of a workerd environment
|
|
// See the `exports` field in package.json
|
|
export default {}
|