You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So far it is impossible to import the style-spec package as a standalone module. Typical use case is using the featureFilter library in order to filter some GeoJSON data outside a map, e.g. in a list or some other component, using the same powerful filter syntax.
From my investigations, this is caused by the way the style-spec package is built using browserify.
Expected behavior
Typical example of importing featureFilter (should be the same for other modules of style-spec), for instance using webpack or similar bundlers.
This sadly ends up with this error (current master branch):
Uncaught Error: Cannot find module 'util'
at s (index.js?fd90:1)
at eval (index.js?fd90:1)
at Object.4.util (index.js?fd90:461)
at s (index.js?fd90:1)
at eval (index.js?fd90:1)
at Object.52../composite (index.js?fd90:11034)
at s (index.js?fd90:1)
at e (index.js?fd90:1)
at eval (index.js?fd90:1)
at eval (index.js?fd90:1)
Suggested solution
I recently found out (see #5502 ) that changing the build script flags in the package.json file of style-spec resolves this issue for the browser, but I'm not able to tell if it could introduce side-effects for Node.js.
This is the way I tried it in my application and now it works as expected.
cd<path-to/style-spec-source>
npm run build && npm pack
cp mapbox-mapbox-gl-style-spec-10.1.0.tgz ../../../style-spec-build
z my-project
npm i <path-to/style-spec-source>/mapbox-mapbox-gl-style-spec-10.1.0.tgz
Hope you guys can fix this behavior using my suggested solution and and release a 10.1.1 package soon... 😄
The text was updated successfully, but these errors were encountered:
So far it is impossible to import the
style-spec
package as a standalone module. Typical use case is using thefeatureFilter
library in order to filter some GeoJSON data outside a map, e.g. in a list or some other component, using the same powerful filter syntax.From my investigations, this is caused by the way the
style-spec
package is built using browserify.Expected behavior
Typical example of importing featureFilter (should be the same for other modules of style-spec), for instance using webpack or similar bundlers.
For usage see #5862 or the featureFilter library README
Actual Behavior
This sadly ends up with this error (current master branch):
Suggested solution
I recently found out (see #5502 ) that changing the build script flags in the package.json file of style-spec resolves this issue for the browser, but I'm not able to tell if it could introduce side-effects for Node.js.
This is the way I tried it in my application and now it works as expected.
Hope you guys can fix this behavior using my suggested solution and and release a
10.1.1
package soon... 😄The text was updated successfully, but these errors were encountered: