Invalid FS bundle size
HI everyone, I'm trying to use electric-sql without the need of using cdn and I got this error while I'm loading the db:
Uncaught (in promise) Error: Invalid FS bundle size: 792 !== 2987805
at Object.getPreloadedPackage (electric-sql-bundle.js:11787:39)
at loadPackage (electric-sql-bundle.js:2021:84)
at electric-sql-bundle.js:2133:7
at electric-sql-bundle.js:2134:7
at te3.Pe2 (electric-sql-bundle.js:11821:57)
I'm using a bundled version (electric-sql-bundle.js) created with esbuild
this is the code of the esbuild const esbuild = require('esbuild');
esbuild.build({
target: 'esnext',
bundle: true,
splitting : false,
format: 'esm',
entryPoints: [
'./node_modules/@electric-sql/pglite/dist/index.js',
],
outfile: './dist/electric-sql-bundle.js',
define: {
'process.env.NODE_ENV': JSON.stringify('development'),
},
external: ['@electric-sql/pglite'],
}).catch(() => process.exit(1));
Probably i did something wrong but i dont find any kind of documentation related to this.
If I did something wrong in the bug report im sorry
I'm getting this as well from following the getting started instructions(yarn)
solution(for me at least): https://discord.com/channels/933657521581858818/934234468514922567/1301530280212828221
I use quasar so I had to apply this in my quasar.conf.js:
extendViteConf(viteConf) {
// Extend the Vite configuration to exclude dependencies from optimization
viteConf.optimizeDeps = {
...viteConf.optimizeDeps,
exclude: ['@electric-sql/pglite'], // replace 'some-library' with the module you want to exclude
}
// Optional: Exclude from Rollup build as well
viteConf.build = {
...viteConf.build,
rollupOptions: {
...viteConf.build?.rollupOptions,
external: ['@electric-sql/pglite'], // ensure that Rollup does not bundle this module
},
}
},
related docs: https://pglite.dev/docs/bundler-support
Hi, using pglite via
import { PGlite } from "https://cdn.jsdelivr.net/npm/@electric-sql/pglite/dist/index.js"
It has been working perfectly fine for about a week or two, until it stopped working with following error:
Uncaught (in promise) Error: Invalid FS bundle size: 2987805 !== 4827589
getPreloadedPackage postgres.js:9
loadPackage postgres.js:9
Module postgres.js:9
Module postgres.js:9
Ee postgres.js:9
te postgres.js:9
I cleared the web browser cache (FF in my case) and the error is gone.
i met the problem too , it appears when i try to create a db, i have worked 2 days for it , but failed
just clear the web browser's cache
I have the exact same error. Using Vite & Vue with chrome.
Hey, did anyone get the solution?
Hey, did anyone get the solution?
For me, as running Vue, I found the solution here: https://pglite.dev/docs/bundler-support . There is also a workaround for Nextjs there. vite config
import { defineConfig } from 'vite'
export default defineConfig({
optimizeDeps: {
exclude: ['@electric-sql/pglite'],
},
})
next config
const nextConfig = {
swcMinify: false,
transpilePackages: [
'@electric-sql/pglite-react', // Optional
'@electric-sql/pglite',
],
}
export default nextConfig
@lroal what is the solution for reactjs
@lroal what is the solution for reactjs
Actually not sure. I thought it was setting the nextjs config as described above. Did you try that ? And also deleting any cache.
I had to add the worker if anyone else is facing that issue. The docs don't show that.
optimizeDeps: {
exclude: [
"@electric-sql/pglite",
"@electric-sql/pglite/worker",
],
},
DO NOT ADD TO ROLL UP
build: {
...,
rollupOptions: {
external: ["@electric-sql/pglite"],
},
},