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

Cannot compile pg version 8.11.0 #1075

Open
cylam0 opened this issue May 25, 2023 · 1 comment
Open

Cannot compile pg version 8.11.0 #1075

cylam0 opened this issue May 25, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@cylam0
Copy link

cylam0 commented May 25, 2023

ncc works well for pg version 8.10.0 but not 8.11.0

Here is an example:

// index.js
import pg from "pg";
export const pool = new pg.query()

When I try to compile this file using ncc build with pg version 8.11.0, it shows the following error:

ncc: Version 0.36.1
ncc: Compiling file index.js into ESM
Error: Module build failed (from ../../../AppData/Roaming/npm/node_modules/@vercel/ncc/dist/ncc/loaders/shebang-loader.js):
UnhandledSchemeError: Reading from "cloudflare:sockets" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "cloudflare:" URIs.
@styfle styfle added bug Something isn't working enhancement New feature or request and removed bug Something isn't working labels May 26, 2023
@styfle
Copy link
Member

styfle commented May 26, 2023

Since Node.js will fail if you try to execute a file that contains import foo from 'cloudflare:sockets', then this is expected.

You can tell ncc to exclude the cloudflare code if you plan to run with Node.js (since ncc is designed for Node.js)

ncc build index.js --external pg-cloudflare

However, we could probably change ncc to relax the protocol check to ignore cloudflare: protocol. Feel free to submit a PR if you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants