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

Invalid FS bundle size #409

Open
dugoalberto opened this issue Oct 28, 2024 · 6 comments
Open

Invalid FS bundle size #409

dugoalberto opened this issue Oct 28, 2024 · 6 comments

Comments

@dugoalberto
Copy link

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

@msfstef msfstef transferred this issue from electric-sql/electric Oct 29, 2024
@binarytide
Copy link

I'm getting this as well from following the getting started instructions(yarn)

@binarytide
Copy link

@binarytide
Copy link

binarytide commented Nov 2, 2024

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
          },
        }
      },

@binarytide
Copy link

related docs: https://pglite.dev/docs/bundler-support

@ludoaubert
Copy link

ludoaubert commented Dec 1, 2024

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
table_edit.js:9
Any help appreciated.

@ludoaubert
Copy link

I cleared the web browser cache (FF in my case) and the error is gone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants