Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

React-Hot-Loader: react-馃敟-dom patch is not detected. React 16.6+ features may not work. #23

Closed
stelmakhivan opened this issue Apr 17, 2019 · 3 comments

Comments

@stelmakhivan
Copy link

stelmakhivan commented Apr 17, 2019

I get the warning in browser console React-Hot-Loader: react-馃敟-dom patch is not detected. React 16.6+ features may not work.

My package.json

"scripts": {
    "start": "react-app-rewired start",
    "build": "react-app-rewired build",
    "test": "react-app-rewired test --env=jsdom",
    "eject": "react-app-rewired eject"
  },
  "devDependencies": {
    "react-app-rewire-hot-loader": "^2.0.1",
    "react-app-rewired": "^2.1.1",
    "react-hot-loader": "^4.8.4"
  }

config-overrides (in root folder)

const rewireReactHotLoader = require('react-app-rewire-hot-loader');

/* config-overrides.js */
module.exports = function override(config, env) {
  config = rewireReactHotLoader(config, env);
  return config;
};

App.js

import React from 'react';
import './App.css';
import { hot } from 'react-hot-loader/root';

const App = () => <div className="container mt-4">app</div>;

export default (process.env.NODE_ENV === 'development' ? hot(App) : App);
@stelmakhivan
Copy link
Author

@Ciantic
Copy link

Ciantic commented Apr 20, 2019

Edit, so I figured it out:

  1. yarn add @hot-loader/react-dom -D
  2. config-overrides.js
const rewireReactHotLoader = require("react-app-rewire-hot-loader");

/* config-overrides.js */
module.exports = function override(config, env) {
    if (env == "development") {
        config.resolve.alias["react-dom"] = "@hot-loader/react-dom";
    }
    config = rewireReactHotLoader(config, env);
    return config;
};

Maybe the parent example by @cdharris could be updated?

@esetnik
Copy link

esetnik commented Jun 4, 2019

Can we add the alias injection to react-app-rewire-hot-loader please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants