Avoid extra assignment for default export

This commit is contained in:
Tim Schaub
2016-12-27 18:25:16 -07:00
parent 3eaa0f412e
commit 490f42d528
5 changed files with 59 additions and 56 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
{
"name": "ol",
"version": "3.21.0-beta.10",
"description": "OpenLayers",
"version": "3.21.0-beta.16",
"description": "OpenLayers as ES2015 modules",
"main": "index.js",
"module": "index.js",
"license": "BSD-2-Clause",
+21 -8
View File
@@ -1,6 +1,6 @@
# `ol`
# ol
[OpenLayers](https://openlayers.org/) for module loaders.
OpenLayers as ES2015 modules.
**Note: This is still a work in progress. Not yet ready for production.**
@@ -13,16 +13,18 @@ Add the `ol` package as a dependency to your project.
Import just what you need for your application:
```js
import Map from 'ol/Map';
import View from 'ol/View';
import TileLayer from 'ol/layer/Tile';
import OSM from 'ol/source/OSM';
import Map from 'ol/map';
import View from 'ol/view';
import TileLayer from 'ol/layer/tile';
import XYZ from 'ol/source/xyz';
var map = new Map({
new Map({
target: 'map',
layers: [
new TileLayer({
source: new OSM()
source: new XYZ({
url: 'https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png'
})
})
],
view: new View({
@@ -31,3 +33,14 @@ var map = new Map({
})
});
```
Note that the module identifiers above (e.g. `ol/map`) are like the `ol.Map` names in the [API documentation](http://openlayers.org/en/latest/apidoc/) with `/` instead of `.` and all lowercase.
See the following examples for more detail on bundling OpenLayers with your application:
* Using [Rollup & Uglify](https://gist.github.com/tschaub/8beb328ea72b36446fc2198d008287de)
* Using [Rollup & Closure Compiler](https://gist.github.com/tschaub/32a5692bedac5254da24fa3b12072f35)
* Using [Webpack & Uglify](https://gist.github.com/tschaub/79025aef325cd2837364400a105405b8)
* Using [Browserify & Uglify](https://gist.github.com/tschaub/4bfb209a8f809823f1495b2e4436018e)
This is still a work in progress. See [openlayers/openlayers#6302](https://github.com/openlayers/openlayers/pull/6302) for ongoing discussion.