-
Notifications
You must be signed in to change notification settings - Fork 51
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
Incompatibility with Vitejs #371
Comments
Hey @Digital-Coder 👋 Thanks for sharing, this may be related |
@stepankuzmin I forgot to update ! I was able to make it work for vitejs by changing src/utils/mapbox-gl.js to something like this:
For
I am not opening PR because I saw in your codebase you are using types so this solution might need some tweaks, but hopefully its very helpful |
Hi @Digital-Coder 👋 This should work now with the latest release v1.16.1 |
seems to be working, thank you ! |
Describe the bug
Hi @stepankuzmin! I have been migrating open source
[email protected]
application to Vitejs, but this package has some problems. By adding@urbica/react-map-gl
, in the browser console I get errors like :global is not defined
and if I find hacky way to add global then I get error thatrequire is not defined
. I think this package is not compatible with[email protected] (webpack 5)
too because it does not ship with nodejs polyfills anymore.It seems that these issues are caused by isBrowser function and require() commonJs import here src/utils/mapbox-gl.js and one of the users has responded by potential fix here : #330.
I would really appreciate if you could look into this,
To Reproduce
You could check this playground here with Vite
npm run dev
in the terminaland open browser console
or
npm create vite@latest
npm i mapbox-gl @urbica/react-map-gl
add map to the app.jsx
check browser console
Expected behavior
Compatability with webpack v4,v5, and Vite which uses rollup bundler
The text was updated successfully, but these errors were encountered: