Javascript 在网页包中填充高图表

Javascript 在网页包中填充高图表,javascript,highcharts,webpack,Javascript,Highcharts,Webpack,我得到了这个webpack.config.js定义: module.exports = { context: __dirname + "/app", output: { path: path.resolve(__dirname, "../Scripts"), filename: "bundle.js" }, entry: ["./app.ts", "angular", "angular-ui-router", "jquery",

我得到了这个webpack.config.js定义:

module.exports = {
    context: __dirname + "/app",

    output: {
        path: path.resolve(__dirname, "../Scripts"),
        filename: "bundle.js"
    },

    entry: ["./app.ts", "angular", "angular-ui-router", "jquery", path.join(__dirname, "vendor", "highcharts.src.js"), path.join(__dirname, "node_modules/angular-local-storage/dist", "angular-local-storage.js")],

    stats: "minimal",

    resolve: {
        extensions: ["", ".webpack.js", ".web.js", ".ts", ".js"]
    },

    plugins: [
        // new webpack.optimize.UglifyJsPlugin(),
        new webpack.ProvidePlugin({
            "Highcharts": "imports?this=>global!exports?global.Highcharts",
        })
    ],

    devtool: "source-map",

    module: {
        loaders: [
            { test: /\.html$/, loader: "raw", exclude: exclusionRegexs },
            { test: /\.css$/, loader: "style!css", exclude: exclusionRegexs },
            { test: /\.ts$/, loader: "ng-annotate!ts-loader", exclude: exclusionRegexs }
        ]
        /*preLoaders: [
            {
                test: /\.js$/, // include .js files
                exclude: /node_modules/, // exclude any and all files in the node_modules folder
                loader: "jshint-loader"
            }
        ]*/
    }
};
这一行应该导出highcharts,然后直接将highcharts导入window对象,这就是我想要做的,但它并不完全存在。有一个演示如何做到这一点的例子

new webpack.ProvidePlugin({
    "Highcharts": "imports?this=>global!exports?global.Highcharts",
})
在高图中,src为:

Highcharts = win.Highcharts = win.Highcharts ? error(16, true) : {};
很明显,它被放在了窗户上

我假设这与条目有关,数组中有一条路径直接指向定义highcharts的正确位置,并且它正确地绑定了它

我想我没有把ProvidePlugin highcharts条目和源条目链接起来吧

我从webpack生成输出中得到的当前错误是:

未找到模块:错误:无法解析模块“导出”


你弄明白了吗?我在导入highcharts+并将其导出到我的网页es6项目中时也遇到了问题。不,我认为提供插件是一个不错的选择!