babel的模块化导入插件, 兼容 @supermapgis/iclient-leaflet, @supermapgis/iclient-mapboxgl, @supermapgis/iclient-ol.
import { Logo } from '@supermapgis/iclient-leaflet';
new Logo();
↓ ↓ ↓ ↓ ↓ ↓
var Logo = require('@supermapgis/iclient-leaflet/control/Logo.js').Logo;
new Logo();
以@supermapgis/iclient-leaflet为例
npm install @supermapgis/babel-plugin-import --save-dev
Via .babelrc or babel-loader.
{
"plugins": [
['@supermapgis/babel-plugin-import', { libraryName: '@supermapgis/iclient-leaflet' }]
]
}