【问题标题】:Blank white screen React & Webpack / Babel has been moved to babel-core空白白屏 React & Webpack / Babel 已移至 babel-core
【发布时间】:2016-08-18 15:33:54
【问题描述】:

我正在学习 React 教程,并且在设置过程中出现空白屏幕。当我运行 npm start 时,我只得到一个空白的白屏,但​​是当我检查元素时我可以看到空白的 div。

I found a similar issue here but the solution doesn't work for me

我收到 1 个错误:babel 的节点 API 已移至 babel-core。 @多主

我已经从 github 文件中复制了所有确切的文件,这仍然是我得到的。

我已经尝试过 npm uninstall babel -g 但它仍然给出相同的错误和白屏。

这是我的 webpack.config.js

module.exports = {
  entry: './main.js',
  output: {
    path: './',
    filename: 'index.js'
  },
  devServer: {
    inline: true,
    port: 3333
  },
  module: {
    loaders: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        loader: 'babel',
        query: {
          presets: ['es2015', 'react']
        }
      }
    ]
  }
}

这是我的 package.json

    {
    "name": "es6-react-setup",
    "version": "1.0.0",
    "main": "index.js",
    "scripts": {
        "start": "webpack-dev-server"
    },
    "author": "",
    "license": "ISC",
    "dependencies": {
        "babel-core": "^6.2.1",
        "babel-loader": "^6.2.0",
        "babel-preset-es2015": "^6.1.18",
        "babel-preset-react": "^6.1.18",
        "react": "^0.14.3",
        "react-dom": "^0.14.3"
    },
    "description": "Setup files for React in ES6 lessons"
}

【问题讨论】:

    标签: reactjs webpack babeljs


    【解决方案1】:

    我尝试删除 node_modules 并再次重新安装所有依赖项,它对我有用。

    我认为这是该帖子的副本:Using webpack with babel and babel-preset-react and babel-preset-es2015

    【讨论】:

      猜你喜欢
      • 2016-11-08
      • 2021-03-04
      • 2018-03-02
      • 1970-01-01
      • 2023-03-13
      • 2019-10-10
      • 1970-01-01
      • 2016-02-04
      • 2019-08-20
      相关资源
      最近更新 更多