首页 新闻 赞助 找找看

针对leaflet和esri-leaflet在ES6中做externals配置

0
[待解决问题]

我在ES6代码中引用了几个大的库,如下:

import "leaflet";
import { tiledMapLayer as esriMap } from "esri-leaflet";
import { tiledMapLayer as superMap } from "@supermap/iclient-leaflet";

我想做成cdn,在index.html里已经写好了script标签,打包时我就不想将这些库打包了,所以要配置webpack.base.conf.js下的externals,但做如下配置运行打包文件会报错:

leaflet:{
commonjs:'leaflet',
root:'L'
},
"esri-leaflet":{
commonjs:'tiledMapLayer'
},
"@supermap/iclient-leaflet":{
commonjs:'tiledMapLayer'
}

各位大神,帮我看看externals该怎么配

蛤蟆王子的主页 蛤蟆王子 | 初学一级 | 园豆:6
提问于:2018-06-04 10:42
< >
分享
所有回答(1)
0
externals:{
leaflet:"L",
esrilib:"L.esri",
supermaplib:"L.supermap"
}
 
 
 
 
 
import L from "leaflet";
import { tiledMapLayer as esriMap } from "esrilib";
import { tiledMapLayer as superMap } from 'supermaplib'
蛤蟆王子 | 园豆:6 (初学一级) | 2018-06-04 11:44
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册