Closed oscarhermoso closed 11 months ago
I think this should go in the vite repo then 😉
There is no PostgresError
as an export in index.js, I don't think this is related to vite.
export {PostgresError} where is, We seem to expect it in esm behavior.
Steps to reproduce
pnpm run build
Expected result
Build succeeds
Actual result
Fine running in dev mode, but fails at build time with error:
SyntaxError: The requested module 'postgres' does not provide an export named 'PostgresError'
Workaround
Works fine if I don't unpack
PostgresError
from the importDetails
Looks like this might be related to https://github.com/porsager/postgres/issues/226
Dependencies and logs
### Dependencies #### Versions ```sh $ pnpm --version 8.3.1 $ node --version v18.17.0 ``` #### `package.json` ```json { "...": "...", "type": "module", "scripts": { "build": "vite build" }, "dependencies": { "postgres": "3.3.5", "vite": "4.4.9", "...": "..." } } ``` ### Logs ``` #15 19.37 import { PostgresError } from "postgres"; #15 19.37 ^^^^^^^^^^^^^ #15 19.37 SyntaxError: The requested module 'postgres' does not provide an export named 'PostgresError' #15 19.37 at ModuleJob._instantiate (node:internal/modules/esm/module_job:131:21) #15 19.37 at async ModuleJob.run (node:internal/modules/esm/module_job:213:5) #15 19.37 at async ModuleLoader.import (node:internal/modules/esm/loader:308:24) #15 19.37 at async analyse (file:///app/node_modules/.pnpm/@sveltejs+kit@1.22.5_svelte@4.1.2_vite@4.4.9/node_modules/@sveltejs/kit/src/core/postbuild/analyse.js:83:16) #15 19.37 at async MessagePort.