【问题标题】:Hot reload not working with react and webpack热重载不适用于 react 和 webpack
【发布时间】:2019-05-29 11:13:33
【问题描述】:

热重载刚刚停止工作。我花了几天的时间学习教程和故障排除。我完全被难住了。最后一个配置在没有添加 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'
});

【问题讨论】:

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


    【解决方案1】:

    React 热加载器目前不适用于钩子。详情请见gaearon/react-hot-loader#1088

    【讨论】:

      猜你喜欢
      • 2019-10-11
      • 1970-01-01
      • 2020-11-24
      • 2018-09-15
      • 2021-08-03
      • 1970-01-01
      • 2023-03-19
      • 2018-11-24
      • 2019-01-26
      相关资源
      最近更新 更多