Import in ES6 module from ol.js file in dist folder
See original GitHub issueHi, I’m trying to use the full ol library importing it in an ES6 module like that
import * as ol from '../../vendor/ol/ol.js';
When I run my web app, ol is not defined because there’s no export in dist/ol.js file
I know for sure that if the file has this kind of export
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.ol=n():t.ol=n()}(self,(function(){return etc...
It will be possibile to import it as I want.
The question is, is there a way to build the ol.js in that form? How it can be done?
I tried cloning the openlayer repo but I can’t find a way…
I thought to remove the commonjs() option from the rollup config bundler but I had this error
Can someone please help me?
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
I ran into some other problems trying to build the full lib as umd and decided it would be script tag only. I think there were issues with the GeoTIFF workers, but can’t recall. It could be that someone else can solve the problems.
If you already have a bundle/build step in your application, you will benefit from importing just the modules you need. Unless your application uses every format, every source, all layers and renderers, etc., the full build is more than you need.
You have to fork this repository and push to your fork, then you can create a pull request here.