esri-leaflet throws error when bundled with Rollup
See original GitHub issue-
Browser and version: n/a
-
Version of Leaflet (L.version): 1.5.1
-
Version of esri Leaflet (L.esri.VERSION): 2.3.0
-
Version of Rollup: 1.21.2
-
Steps to reproduce the error:
- yarn add esri-leaflet
- Write some code to import { tiledMapLayer } from ‘esri-leaflet’
- rollup
-
What happens is [X]. I get an error:
[!] (plugin buble) SyntaxError: Unexpected token (2:8)
node_modules/esri-leaflet/package.json (2:8)
1 : {
2 : "name": "esri-leaflet",
^
SyntaxError: Unexpected token (2:8)
at Object.pp$4.raise (/node_modules/acorn/dist/acorn.js:2825:15) was expecting [Y].
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Converting ArcGIS Server JSON to GeoJSON?
I downloaded FWTools. When I run that command, I get the error 'Unable to open datasource 'My URL here' with the following drivers....
Read more >Using the ArcGIS API for JavaScript in Applications built with ...
Exclude ArcGIS API modules from any bundling done by other module loaders; Load the ArcGIS API for JavaScript via a script tag on...
Read more >How to use rollup with Leaflet 1.1.0 to create a single bundle?
After running it through rollup I'm getting a parse error on a line which I've traced to leaflet/src/Leaflet.js at line 35: window.L =...
Read more >How to diagnose error rendering Esri_2020_Land_Cov...
Solved: Dear Community. I am trying to load in ESRI's new 10m land cover data to a Leaflet map, but having trouble.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Esri-leaflet isn’t a CommonJS library. it’s written in ES6.
you may have other problems, but at a minimum, you need to tell
rollup-plugin-commonjs
about that (or omit the plugin entirely if you aren’t actually trying to bundle any CJS dependencies).I am trying to follow your replication steps, I do not get the error:
npm install --global rollup
(this installsv1.21.4
)npm init -y
npm install esri-leaflet
main.js
with contents:rollup main.js --format iife --name "myBundle" --file bundle.js
Outputs: