Replies: 1 comment 5 replies
-
The code should be tree shaken correctly, you can verify that here: Are you sure you're exporting this from a page in the pages directory and not somewhere else? |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
As per the Postgres docs I have something similar to this in
./db/index.ts
:The problem is when I try to use it in a page.
I get the following error
Module not found: Can't resolve 'dns' in '/path/to/project/node_modules/pg/lib
This is because the
import pg from "../db"
and thereforeimport {Pool} from 'pg';
is running client side and failing. How can I fix this without doing the old method of creating a client side api request for this?Beta Was this translation helpful? Give feedback.
All reactions