解决问题:ERROR Module build failed Error You gave us a visitor for the node type NumericLiteral but it’s not a valid type

创建一个react/es6项目,使用babel 6编译项目,.babelrc配置如下:

{
  "presets": ["es2015", "react"]
}

原来的配置是没有es2015的,使用这个配置后报错信息如下:

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配置文件如下:

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'
      }
   ]
  }
};

解决步骤如下:

1、首先移除node_modules目录

2、然后重新安装所有依赖,问题即可解决。

以上就是“ERROR Module build failed Error You gave us a visitor for the node type NumericLiteral but it’s not a valid type”和“you gave us a visitor for the node type staticblock but it’s not a valid type”的解决办法,希望对你有帮助,如有错误,欢迎在下方评论中指正。

来源:

https://www.srcmini02.com/1843.html

微信公众号
手机浏览(小程序)
0
分享到:
没有账号? 忘记密码?