Replies: 1 comment 3 replies
-
From what I briefly looked into:
I'm not sure how Angular's dev server works, but just looking at the error logs, it seems to be loading the wasm from the wrong place(from file protocol). Maybe you can fix it via manually setting two things. pglite/packages/pglite/src/interface.ts Lines 90 to 91 in bfddaaa |
Beta Was this translation helpful? Give feedback.
-
Hey everyone, I am trying to work with PGlite in the browser.
I have an Angular web app that loads PGlite from the npm package, as shown in the documentation.
However when the following call is executed:
const db = new PGlite()
And the browser tries to load the wasm file from the npm package I get the following errors on the browser console :
"Not allowed to load local resource: file:///C:/....../node_modules/@electric-sql/pglite/dist/postgres.wasm"
"Not allowed to load local resource: file:///C:/....../node_modules/@electric-sql/pglite/dist/postgres.data"
"ERROR Error: Uncaught (in promise): TypeError: Failed to fetch"
Note that I am using Angular's dev server
ng serve
.FWIW, I managed to test PGlite on a simple HTML document loaded without a web server into Chrome, by using the CDN module import.
Any suggestions are welcome, thank you!
Beta Was this translation helpful? Give feedback.
All reactions