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

[Bug] Warning during vite build: "spawn" is not exported by "__vite-browser-external" #3110

Open
oscar-b opened this issue Oct 2, 2024 · 7 comments
Labels
bug Something isn't working P2 - workaround exists

Comments

@oscar-b
Copy link

oscar-b commented Oct 2, 2024

Loader

"@loaders.gl/core": "^4.2.5",

Description

vite v5.4.8 building for production...
node_modules/@loaders.gl/core/node_modules/@loaders.gl/worker-utils/dist/lib/process-utils/child-process-proxy.js (56:50): "spawn" is not exported by "__vite-browser-external", imported by "node_modules/@loaders.gl/core/node_modules/@loaders.gl/worker-utils/dist/lib/process-utils/child-process-proxy.js".
node_modules/@loaders.gl/worker-utils/dist/lib/process-utils/child-process-proxy.js (56:50): "spawn" is not exported by "__vite-browser-external", imported by "node_modules/@loaders.gl/worker-utils/dist/lib/process-utils/child-process-proxy.js".

Expected Behavior

No response

Steps to Reproduce

Compile project with Vite

Environment

  • Framework version: "@loaders.gl/core": "^4.2.5"
  • Browser:
  • Node: v22.3.0
  • OS: macOS 15.0 (24A335)

Logs

No response

@oscar-b oscar-b added the bug Something isn't working label Oct 2, 2024
@ibgreen
Copy link
Collaborator

ibgreen commented Oct 2, 2024

@oscar-b Thanks for reporting.

However without a repro this isn't really actionable (other than doing a speculative refactor of the worker-utils)

  • To make this actionable, we would need some minimal repro.
  • We build our examples with vite, which is still working for us as far as I know.
  • perhaps you are using a different vite version, a different config, including different modules etc.
  • Maybe you can make a branch with a modified example that does trigger this issue?

@ibgreen
Copy link
Collaborator

ibgreen commented Oct 2, 2024

Also, does this actually break the build, or is it just a warning?

@oscar-b
Copy link
Author

oscar-b commented Oct 2, 2024

Also, does this actually break the build, or is it just a warning?

As far as I can see, it's only a warning. I don't know how I'd trigger the use of it though, or why it'd need spawn in the browser?

I will see if I can setup a minimal repo with test, but it being just a warning might also be part of the issue I guess :)

@ibgreen
Copy link
Collaborator

ibgreen commented Oct 2, 2024

why it'd need spawn in the browser?

  • It doesn't.
  • A design goal of loaders.gl is to create a library that works seamlessly in both Node.js and browsers.
  • In some situation (workers in this case) that requires using different code paths.
  • Getting various bundlers and Node to handle that gracefully in all cases is quite tricky, requires iteration and testing.
  • Would cretainly love to remove this warning, but lots of higher priority work.

@ibgreen ibgreen changed the title [Bug] "spawn" is not exported by "__vite-browser-external" [Bug] Warning during vite build: "spawn" is not exported by "__vite-browser-external" Oct 2, 2024
@oscar-b
Copy link
Author

oscar-b commented Oct 2, 2024

@ibgreen I see! Well it doesn't immediately seem to be causing issues, so this is most likely a quite harmless warning. I guess something like this could be used to filter out the warning if one would want to: https://vitejs.dev/config/shared-options.html#customlogger

@prusswan
Copy link

prusswan commented Oct 3, 2024

I have a related problem: trying to build a Custom Layer in iife format so it can be used in/with pydeck results in:

https://rollupjs.org/troubleshooting/#error-name-is-not-exported-by-module

Probably related: #2000

My branch if anyone is interested: https://github.com/prusswan/deck.gl-pmtiles/tree/overture

@spacedawwwg
Copy link

Seeing this now, cant seem to suppress the warning even with https://vitejs.dev/config/shared-options.html#customlogger

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P2 - workaround exists
Projects
None yet
Development

No branches or pull requests

4 participants