-
Notifications
You must be signed in to change notification settings - Fork 16
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
Voyager is using NodeJS modules which are problematic browser bundles #75
Comments
Node.js Module Resolution Fix for Browser EnvironmentProblemThe application was encountering the following error during runtime:
This occurred because Node.js built-in modules (particularly SolutionThe issue was resolved by implementing a comprehensive polyfill strategy in the Vite configuration:
Implementation Details// In vite.config.ts
resolve: {
alias: {
// Explicit aliasing for Node.js built-ins
path: 'path-browserify',
'node:path': 'path-browserify',
}
},
optimizeDeps: {
esbuildOptions: {
define: {
global: 'globalThis',
},
format: 'esm',
},
include: ['path-browserify']
}
|
It turned out those changes aren't enough and I did another change on the voyager side. |
When importing voyager into a browser app in order to add an orbitdb to voyager, it is necessary to use polyfills in order to suppress compilation and bundling errors.
It would be easier if that library works out of the box for browser and NodeJS without configuring polyfills.
Not sure if that is possible by providing a separate build for browsers.
The text was updated successfully, but these errors were encountered: