Cannot resolve module 'child_process'

ERROR in ./~/xmlhttprequest/lib/XMLHttpRequest.js
Module not found: Error: Cannot resolve module 'child_process' in D:\workspace\wosoPro\node_modules\xmlhttprequest\lib
 @ ./~/xmlhttprequest/lib/XMLHttpRequest.js 15:12-36
Child html-webpack-plugin for "index.html":
    chunk    {0} index.html 541 kB [rendered]
        [0] ./~/html-webpack-plugin/lib/loader.js!./index.html 1.71 kB {0} [built]
        [1] ./~/lodash/lodash.js 539 kB {0} [built]
        [2] (webpack)/buildin/module.js 241 bytes {0} [built]

解决方法:

解决问题的图片

在webpack.base.config.js文件中添加:

externals: [{
   xmlhttprequest:'{XMLHttpRequest:XMLHttpRequest}'
}]

参考来源:https://github.com/webpack/webpack-dev-server/issues/66

猜你喜欢

转载自blog.csdn.net/flitrue/article/details/78055220