davidvitora-customize-cra-react-refresh

1.0.2 • Public • Published

Description

Provides a simple, no frills way to integrate react-refresh into your create-react-app using customize-cra and @pmmmwh/react-refresh-webpack-plugin.

Installation

  1. Install dependencies

    npm install -D react-app-rewired customize-cra customize-cra-react-refresh
    
  2. Create or update your config-overrides.js

    const { override } = require("customize-cra");
    const { addReactRefresh } = require("customize-cra-react-refresh");
    
    /* config-overrides.js */
    module.exports = override(addReactRefresh({ disableRefreshCheck: true }));

    Note: disableRefreshCheck: true may be necessary. See #3 for more details.

  3. 'Flip' the existing calls to react-scripts in npm scripts for start, build and test

      /* package.json */
    
      "scripts": {
    -   "start": "react-scripts start",
    +   "start": "react-app-rewired start",
    -   "build": "react-scripts build",
    +   "build": "react-app-rewired build",
    -   "test": "react-scripts test --env=jsdom",
    +   "test": "react-app-rewired test --env=jsdom",
        "eject": "react-scripts eject"
    }

Credits

Original idea based on comment by @drather19.

Readme

Keywords

none

Package Sidebar

Install

npm i davidvitora-customize-cra-react-refresh

Weekly Downloads

1

Version

1.0.2

License

ISC

Unpacked Size

2.66 kB

Total Files

3

Last publish

Collaborators

  • davidvitora