-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
Trying to use deck.gl with Vite does not work (promisify error) #2320
Comments
Pretty sure the library is trying to use nodejs code, which Vite doesn't polyfill. |
Expected behavior - the package is not written for the browser and Vite doesn't polyfill Node built-ins. |
Encountering similar issue when I try to migrate a project I'm working on from Vue CLI to Vite. Realized is because some of Deck.gl's dependencies are coded to be isomorphic. See this line: The My understanding is Webpack will replace these modules with an empty object (https://github.com/defunctzombie/package-browser-field-spec#ignore-a-module). But this doesn't seem to be handled very well at the moment by Vite. I have tried different combinations of @yyx990803 Can we keep this issue open or at least reopen it under a better title? As I believe the issue that is being surfaced out (Vite's handling of |
This problem affects another Uber project XVIZ which also has loaders.gl as dependency. |
@yongjun21 -- I am also experiencing this bug/problem, but I have found a workaround. The problem is exactly as you describe: those objects which are present in Node are causing problems for loaders.gl, and thus deck.gl doesn't load. I'm no expert on this but I found that if you null out a few objects in vite.config.ts // ...
export default defineConfig({
// plugins: [...]
define: {
requireFromFile: null,
'process.platform': null,
'process.version': null
}
}) I still get about a dozen error messages during the I'm pasting the errors below so google can point others this this page. Error messages during build:
I hope this helps. |
Describe the bug
When trying to use deck.gl, running
npm run build
fails with an error about promisify.Reproduction
Here's a demonstration repo: https://github.com/fdb/vite-bug-deck-gl.
I've also made a demonstration repo with webpack, which does not give an error: https://github.com/fdb/webpack-deck-gl
npm init @vitejs/app
and choose Vanilla.cd
into the folder and install dependencies.deck.gl
withnpm install @deck.gl/core @deck.gl/layers
main.js
with the basic "hello world" examplenpm run dev
) works well.npm run build
This gives the following error:
System Info
Logs (Optional if provided reproduction)
The text was updated successfully, but these errors were encountered: