我尝试在我的项目中包含LayerSwitcher Custom Control和webpack,但我总是收到ol.inhereits
在此行中未定义的错误:
ol.inherits(ol.control.LayerSwitcher, ol.control.Control);
https://github.com/Viglino/ol3-ext/blob/ddc2f631348f8b1cfb5d24e8cf83ed13c262411d/dist/ol3-ext.js#L94
我已经在firefox 57中调试了这个(见截图),虽然模块已初始化/导入,但我不知道为什么找不到该方法。 遗失了什么吗?
我的webpack配置如下:
const path = require('path');
var webpack = require("webpack");
module.exports = {
entry: './index.js',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist'),
libraryTarget: 'var',
library: 'IndexJS'
},
devtool: 'source-map',
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel-loader",
query: {
presets: ['env']
}
}
],
rules: [
{
test: require.resolve("./ol3-ext-1.0.1/dist/ol3-ext.js"),
loader: "imports-loader?$=jquery,ol=ol,ol.control=ol/control"
},
{
test: require.resolve("./ol3-ext-1.0.1/dist/ol3-ext.js"),
loader: "exports-loader?LayerSwitcher=LayerSwitcher,LayerPopup=LayerPopup"
}
]