【发布时间】:2016-02-04 02:13:15
【问题描述】:
我正在尝试转编译我的 react/es6 代码,并且来自 browserify。由于新的 babel 6 版本以及大多数教程现在已经过时的事实,我正在努力创建 webpack 构建。 这适用于我的 .babelrc:
{
"presets": ["react"]
}
但是当我把它改成这样的时候:
{
"presets": ["es2015", "react"]
}
它会抛出这个神秘的错误:
ERROR in ./client/App.js
Module build failed: Error: You gave us a visitor for the node type "NumericLiteral" but it's not a valid type
如果有帮助的话,这是我的 webpack.config.js:
module.exports = {
entry: "./client/App.js",
output: {
filename: "public/bundle.js"
},
resolve: {
extensions: ['', '.js', '.jsx']
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel'
}
]
}
};
我有什么明显的遗漏吗?我还交换了预设的顺序,似乎没有什么区别。我的节点模块中有 babel-core、babel-loader、babel-preset-es2015、babel-preset-react 和 webpack。
【问题讨论】:
-
你看过github repo的troubleshoot section吗?
标签: javascript reactjs webpack babeljs