报错代码如下
ERROR in ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0 !./src/VueHighcharts.vue Module not found: Error: Can't resolve 'highcharts' in 'D:\ownProject\vuehighcha rts\src' @ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src /VueHighcharts.vue 7:0-36 @ ./src/VueHighcharts.vue @ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./dem o/App.vue @ ./demo/App.vue @ ./demo/main.js
原因是 Module not found: Error: Can’t resolve ‘highcharts’ 找不到“highcharts”这个包
解决办法安装highcharts 包依赖
npm install highcharts –save-dev
最后执行webpack,执行正常,如下
D:\ownProject\vuehighcharts>webpack (node:7808) DeprecationWarning: loaderUtils.parseQuery() received a non-string v alue which can be problematic, see https://github.com/webpack/loader-utils/issue s/56 parseQuery() will be replaced with getOptions() in the next major version of loa der-utils. Hash: c0dd5b4a1bb6d149d030 Version: webpack 2.7.0 Time: 3680ms Asset Size Chunks Chunk Names bundle.js 1.35 MB 0 [emitted] [big] main [0] ./~/process/browser.js 5.42 kB {0} [built] [1] ./~/vue-loader/lib/component-normalizer.js 1.12 kB {0} [built] [2] ./demo/App.vue 1.45 kB {0} [built] [3] ./~/vue/dist/vue.common.js 267 kB {0} [built] [4] ./data/data.js 3.97 kB {0} [built] [5] ./demo/main.js 134 bytes {0} [built] [6] ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!. /demo/App.vue 916 bytes {0} [built] [7] ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!. /src/VueHighcharts.vue 1.63 kB {0} [built] [9] ./~/css-loader!./~/vue-loader/lib/style-rewriter.js?id=data-v-60c53a96!./ ~/sass-loader/lib/loader.js!./~/vue-loader/lib/selector.js?type=styles&index=0!. /demo/App.vue 1.23 kB {0} [built] [10] ./~/css-loader/lib/css-base.js 1.51 kB {0} [built] [12] ./src/VueHighcharts.vue 1.29 kB {0} [built] [13] ./~/vue-loader/lib/template-compiler.js?id=data-v-60c53a96!./~/vue-loader /lib/selector.js?type=template&index=0!./demo/App.vue 1.67 kB {0} [built] [15] ./~/vue-style-loader!./~/css-loader!./~/vue-loader/lib/style-rewriter.js? id=data-v-60c53a96!./~/sass-loader/lib/loader.js!./~/vue-loader/lib/selector.js? type=styles&index=0!./demo/App.vue 1.45 kB {0} [built] [16] ./~/vue-style-loader/lib/addStylesClient.js 6.05 kB {0} [built] [18] (webpack)/buildin/global.js 509 bytes {0} [built] + 4 hidden modules