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

plugin not working when used in React components #37

Closed
namibian15 opened this issue Nov 30, 2016 · 4 comments
Closed

plugin not working when used in React components #37

namibian15 opened this issue Nov 30, 2016 · 4 comments

Comments

@namibian15
Copy link

When using the bundled version like so:
import {} from 'leaflet.vectorgrid/dist/Leaflet.VectorGrid.bundled.js'
and one tries to use Protobuf, the console report 'Pbf undefined'

When 'import' all the files require by Leaflet.VectorGrid, this error goes away, but then it complains that L.Renderes.Tile is undefined

@data-ux
Copy link

data-ux commented Dec 8, 2016

I'm having the same problem, but I don't think the it's related to React specifically. It seems Leaflet.VectorGrid.bundled.js does not play well with JS bundlers (Webpack/Browserify). VectorGrid expects Pbf to be defined in the global scope, but if the bundle is referenced with 'import' and bundled with Webpack, the global Pbf object will not be available.

@namibian15
Copy link
Author

namibian15 commented Dec 8, 2016 via email

@puntonero
Copy link

I've a similar problem with my local package where I add inside onUse function:
api.addFiles([ '.npm/package/node_modules/leaflet.vectorgrid/dist/Leaflet.VectorGrid.bundled.js' ], 'client');
(so is not an "import" reference)
and in browser console i get the following:
Uncaught ReferenceError: Pbf is not defined

I'm not using webpack: I'm playing with meteorkitchen.com generator so I need to find alternative solutions

@stereobooster
Copy link

I found solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants