Webpack.config.js:配置具有未知属性“默认”

时间:2019-03-26 16:45:42

标签: javascript webpack babeljs

我已经将所有内容从一个工作项目(最终的热重载示例)转移到了我现有的使用梯形cms的项目中。我卸载了我项目中的所有dev依赖项,并将工作项目中的所有确切依赖项都安装到了我的(webpack,babel等)中。

由于某些原因,web.config.js文件无法解析es6语法

export default 

哪个出现此错误:

- configuration has an unknown property 'default'.

如果我切换到以下选项,它将起作用:

const config = ...
module.exports = config;

在我项目的其他地方,我使用了其他es6语法,并且可以使用...

这是package.json中的依赖项,它与具有'export default'语法的示例项目完美配合。

"dependencies": {
"babel-cli": "^6.10.1",
"babel-core": "^6.10.4",
"babel-eslint": "^8.2.3",
"babel-loader": "^7.1.1",
"babel-plugin-react-transform": "^3.0.0",
"babel-plugin-transform-runtime": "^6.9.0",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.11.1",
"babel-register": "^6.9.0",
"babel-runtime": "^6.9.2",
"chokidar": "^2.0.3",
"css-loader": "^0.28.11",
"css-modules-require-hook": "^4.0.1",
"eslint": "^4.19.1",
"eslint-plugin-react": "^7.8.1",
"express": "^4.14.0",
"prop-types": "^15.6.1",
"react": "^16.3.2",
"react-dom": "^16.3.2",
"react-hot-loader": "^4.1.3",
"react-redux": "^5.0.7",
"redux": "^4.0.0",
"style-loader": "^0.21.0",
"webpack": "^4.8.3",
"webpack-dev-middleware": "^3.1.3",
"webpack-hot-middleware": "^2.12.1",
"webpack-node-externals": "^1.7.2"

知道为什么会这样吗?

0 个答案:

没有答案