README
babel-plugin-transform-react-hot-loader-wrapper
Wraps all exported React components (whose names match the configured pattern) with react-hot-loader to enable hot-reloading, even if the React components are spread across Webpack chunks using code splitting.
For example, this source file:
import React from 'react'
export const A = () => <p>a</p>
becomes:
import React from 'react'
import { hot } from 'react-hot-loader/root'
export const A = hot(() => <p>a</p>)
Usage
npm install --save-dev @sourcegraph/babel-plugin-transform-react-hot-loader-wrapper
# or
yarn add --dev @sourcegraph/babel-plugin-transform-react-hot-loader-wrapper
Then add this to your Babel configuration file (.babelrc
or babel.config.js
):
{
"plugins": [
[
"@sourcegraph/babel-plugin-transform-react-hot-loader-wrapper",
{
"modulePattern": "src/.*Page\\.tsx