I'm trying to add mapbox-gl-draw to my project which uses rollup, but the require call in modes/index.js blocks it from working.
Lines 10 to 14 in modes/index.js don't seem to add any functionality as far as I can tell, but they break the rollup-plugin-commonjs plugin because it thinks it needs to do require() during runtime. Removing the lines resolves this issue.
The error message as thrown by the compiled code: Dynamic requires are not currently supported by rollup-plugin-commonjs.
(Note that I shimmed out geojsonhint, but that is because it expects fs to exist, and I'm not using the functionality it is required for.)
mapbox-gl-js version: 0.48.0
mapbox-gl-draw version: 1.0.9
I'm trying to add mapbox-gl-draw to my project which uses rollup, but the require call in modes/index.js blocks it from working.
Lines 10 to 14 in modes/index.js don't seem to add any functionality as far as I can tell, but they break the rollup-plugin-commonjs plugin because it thinks it needs to do require() during runtime. Removing the lines resolves this issue.
The error message as thrown by the compiled code:
Dynamic requires are not currently supported by rollup-plugin-commonjs
.(Note that I shimmed out geojsonhint, but that is because it expects
fs
to exist, and I'm not using the functionality it is required for.)My rollup config:
package.json:
And then in my application I use:
Edit: I can work around this issue by using the compiled version: