我正在尝试将无数据显示(https://www.npmjs.com/package/highcharts-no-data-to-display)与highcharts包含在内。
我得到的错误就像无法读取undefined的属性'prototype'。从我可以看到这些模块无法访问Highcharts对象。
这是我的webpack配置文件
var webpack = require('webpack');
var path = require('path');
var debug = process.env.NODE_ENV!=="production";
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
entry: './main.js',
output:{
path: path.resolve(__dirname, 'dist'),
filename:'Build.js',
publicPath: '/'
},
resolve:{
extensions: ['', '.js'],
root:[
path.resolve(__dirname)
],
moduleDirectories:[path.resolve(__dirname,'node_modules')],
alias:{
'highcharts': 'lib/vendor/highcharts.src',
'highcharts_more': 'lib/vendor/highchartmore.src',
'highcharts_gauge': 'lib/vendor/solid-gauge.src',
'highcharts_no_data': 'lib/vendor/modules/highcharts/no-data-to-display',
},
}
module:{
loaders:[
{ test: __dirname+'/lib/vendor/highcharts.src' ,
loader: 'exports?Highcharts!imports?jquery,proj4'
},
{ test: 'highcharts_more' ,
loader: 'imports?highcharts'
},
{ test: __dirname+'/lib/vendor/modules/highcharts/no-data-to-display',
loader: 'imports?highcharts,highcharts_more'
},
]
},
plugins:[
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
"window.jQuery":"jquery",
_:"underscore",
Highcharts:"highcharts"
})
]
]}