所以我尝试运行一个项目,在输入ng serve后,它会编译(带有与循环依赖有关的警告),我在浏览器控制台中也看到一条错误消息:
Uncaught Error: Module parse failed: .....\node_modules\d3\node_modules\jsdom \lib\jsdom\level1\core.js setter should have exactly one param (412:14)
You may need an appropriate loader to handle this file type.
| return name;
| },
| set nodeName() { throw new core.DOMException();},
| get attributes() { return this._attributes;},
| get firstChild() {
at Object.../../../../d3/node_modules/jsdom/lib/jsdom/level1/core.js (index.js:614)
at __webpack_require__ (bootstrap af271a8a4cb7446182a9:54)
at Object.../../../../d3/node_modules/jsdom/lib/jsdom/level2/core.js (core.js:1)
at __webpack_require__ (bootstrap af271a8a4cb7446182a9:54)
at Object.../../../../d3/node_modules/jsdom/lib/jsdom/level3/core.js (core.js:1)
at __webpack_require__ (bootstrap af271a8a4cb7446182a9:54)
at Object.../../../../d3/node_modules/jsdom/lib/jsdom/level3/index.js (index.js:3)
at __webpack_require__ (bootstrap af271a8a4cb7446182a9:54)
at Object.<anonymous> (jsdom.js:1)
at Object.../../../../d3/node_modules/jsdom/lib/jsdom.js (jsdom.js:360)
这是core.js:
set nodeName() { throw new core.DOMException();},
get attributes() { return this._attributes;},
get firstChild() {
return this._childNodes.length > 0 ? this._childNodes[0] : null;
},
set firstChild() { throw new core.DOMException();},
get ownerDocument() { return this._ownerDocument;},
get readonly() { return this._readonly;},
get lastChild() {
var len = this._childNodes.length;
return len > 0 ? this._childNodes[len -1] : null;
},
set lastChild() { throw new core.DOMException();},
get childNodes() {
return this._childNodes;
},
set childNodes() { throw new core.DOMException();},
Webpack.config.js:
switch (process.env.NODE_ENV) {
case 'prod':
case 'production':
module.exports = require('./config/webpack.prod')({env: 'production'});
break;
case 'test':
case 'testing':
module.exports = require('./config/webpack.test')({env: 'test'});
break;
case 'package':
module.exports = require('./config/webpack.package')({env: 'package'});
break;
case 'dev':
case 'development':
default:
module.exports = require('./config/webpack.dev')({env: 'development'});
}
关于导致此错误的原因有什么想法?