Open
Description
I faced the following error message:
browser-external:worker_threads:9 Module "worker_threads" has been externalized for browser compatibility. Cannot access "worker_threads.isMainThread" in client code. See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
get @ browser-external:worker_threads:9
(anonymous) @ node.js:73
It seems this is related to a change in Vite's default behavior between Vite 4 and Vite 5. This is what the Vite 5 docs say about this error message:
Module externalized for browser compatibility
When you use a Node.js module in the browser, Vite will output the following warning.
Module "fs" has been externalized for browser compatibility. Cannot access "fs.readFile" in client code.
This is because Vite does not automatically polyfill Node.js modules.
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 think the solution is that geotiff.js should start using this module https://github.com/developit/web-worker which uses the Node backend in Node environments, and the browser Worker backend in browser environments.
Metadata
Metadata
Assignees
Labels
No labels