stamen / mapbox-gl-style-diff

Other
2 stars 1 forks source link

Use ES6 modules #16

Closed ebrelsford closed 2 years ago

ebrelsford commented 2 years ago

Use ES6 module syntax (export) rather than setting module.exports, which appears to keep Parcel from exporting the function as expected.

ebrelsford commented 2 years ago

This works for the module itself, but like we discussed, it breaks the standalone viewer because of the export.

This should be fixed in the latest commit. I export both diff functions (temporarily) and import them in the viewer as a module (from dist/module.js).

It's a little bit of a chicken-egg situation otherwise--we need this repo to export a usable module to make a viewer in the other repo (which is in progress).

Think that works for now?

ebrelsford commented 2 years ago

what do you think of adding http-server or some similar simple library to serve the HTML page to get around this?

Weird I wasn't seeing that! I'm serving the page with Python (python3 -m http.server) without any issues.

Let's avoid working on this more if we can because I think we can move over to the diff-viewer soon.

aparlato commented 2 years ago

I'm serving the page with Python (python3 -m http.server) without any issues

That makes sense! I was dropping the HTML file straight into the browser. Loading off any http server solves this CORS issue.

Let's avoid working on this more if we can because I think we can move over to the diff-viewer soon.

👍