Closed founderblocks-sils closed 6 months ago
@vipersils Can you ensure the EventEmitter loaded? LiveQuerySubscription extends the EventEmitter
Adding this to my code: import { EventEmitter } from "events";
yields:
Error: Module "events" has been externalized for browser compatibility. Cannot access "events.EventEmitter" in client code. See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
The documentation on the above link also explicitly states that libraries should not rely on that and this should be reported as a bug to them:
We recommend avoiding Node.js modules for browser code to reduce the bundle size, although you can add polyfills manually. If the module is imported from a third-party library (that's meant to be used in the browser), it's advised to report the issue to the respective library.
I'm guessing it can be worked around by doing some polyfill magic with the vite configs though based on this.
I can confirm that using https://www.npmjs.com/package/vite-plugin-node-polyfills works as a workaround.
New Issue Checklist
Issue Description
Steps to reproduce
Now add this line e.g. to routes/Header.svelte:
import Parse from "parse/node";
And launch the site, check the JS console.
Actual Outcome
Expected Outcome
Parse gets imported correctly.
Environment
Package.json:
Server
no server involved, SDK version see above
linux
local
Database
none
none
none
Client
4.0.0-alpha.12
Logs