热重装无法与React和Webpack一起使用

时间:2019-01-02 20:11:16

标签: reactjs webpack-hmr react-hot-loader

热装刚刚停止工作。我花了几天时间研究教程和故障排除。我完全陷入了困境。上一个配置在没有添加hot(Component)甚至没有加载react-hot-loader文件的情况下都能正常工作。现在我迷路了。请帮忙。

我想知道它是否与我使用React Hooks有关,因此与React&React Dom的版本有关。

使用npm 6.5.0node 10.15.0

"dependencies": {
    "react": "16.7.0-alpha.2",
    "react-dom": "16.7.0-alpha.2",
    "react-router": "4.4.0-beta.6",
    "react-router-dom": "4.4.0-beta.6",
    "truffle-contract": "4.0.0",
    "web3": "1.0.0-beta.37"
  },
  "devDependencies": {
    "@babel/core": "^7.2.2",
    "@babel/preset-env": "^7.2.0",
    "@babel/preset-react": "^7.0.0",
    "acorn": "^6.0.5",
    "ajv": "^6.6.2",
    "babel-eslint": "^9.0.0",
    "babel-loader": "^8.0.4",
    "classnames": "^2.2.6",
    "clean-webpack-plugin": "^0.1.19",
    "cross-env": "^5.2.0",
    "css-loader": "^1.0.1",
    "eslint": "^5.10.0",
    "eslint-plugin-react": "^7.11.1",
    "eslint-plugin-react-hooks": "0.0.0",
    "express": "^4.16.3",
    "file-loader": "^2.0.0",
    "git-stats": "^2.10.10",
    "html-loader": "^0.5.5",
    "html-webpack-plugin": "^4.0.0-beta.5",
    "image-webpack-loader": "^4.6.0",
    "mini-css-extract-plugin": "^0.5.0",
    "node-sass": "^4.11.0",
    "openzeppelin-solidity": "^1.12.0",
    "purecss-sass": "^1.0.0",
    "react-hot-loader": "^4.6.3",
    "sass-lint": "^1.12.1",
    "sass-lint-auto-fix": "^0.15.0",
    "sass-loader": "^7.1.0",
    "style-loader": "^0.23.1",
    "webpack": "^4.27.1",
    "webpack-cli": "^3.1.2",
    "webpack-dev-middleware": "^3.4.0",
    "webpack-dev-server": "^3.1.14"
  } //....

const webpack = require('webpack')
const HtmlWebPackPlugin = require('html-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const path = require('path');
const isDevelopment = process.env.NODE_ENV !== 'production'
const htmlWebpackPlugin = new HtmlWebPackPlugin({
  template: './public/index.html',
  filename: './index.html'
});

1 个答案:

答案 0 :(得分:1)

反应热加载器当前不适用于挂钩。有关详细信息,请参见gaearon/react-hot-loader#1088