Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@snowpack/plugin-react-refresh

snowpackjs41.6kMIT2.5.0

Transforms JavaScript files containing React components automatically to enable React Fast Refresh via Snowpack's HMR API.

readme

@snowpack/plugin-react-refresh

Transforms JavaScript files containing React components automatically to enable React Fast Refresh via Snowpack's HMR API.

npm install --save-dev @snowpack/plugin-react-refresh

Setup

// snowpack.config.json
{
  "plugins": ["@snowpack/plugin-react-refresh", {/* options: see below */}]
}

Plugin Options

Name Type Description
babel boolean or object By default, this plugin uses Babel to add Fast-Refresh code to eligible JS files. If you want to configure & run this yourself, set "babel": false". Alternatively, you can pass a custom Babel configuration object to enhance or override the defaults. Most users won't need this.

How it Works

This plugin will automatically inject HMR event handlers into any file containing a React component.

In most applications, you'll still want some top-level import.meta.hot handling code in your application for any non-React file updates. In our Create Snowpack App templates, this would be the HMR handling snippet found in src/index.js.

changelog

Changelog

For older releases, check our curated release update thread or the raw commit history.

@snowpack/plugin-react-refresh@2.5.0 [2021-04-29]

  • 1b33af55 - plugin-react-refresh: add custom babel config option (#2943) <Maximilian Fellner>

@snowpack/plugin-react-refresh@2.4.2 [2021-04-01]

  • 857d73cb - [ci] yarn format
  • ceb516d0 - [plugin-react-refresh] Solve the problem with MobX observer() HOC (#3058) <yuhongda>
  • 56c5a231 - fix typo in changelog
  • a82cb6b1 - Revert "[plugin-react-refresh] Solve the problem with MobX observer() HOC (#3015)"
  • b07d815b - [ci] yarn format
  • 6e4bb7fe - [plugin-react-refresh] Solve the problem with MobX observer() HOC (#3015) <yuhongda>

@snowpack/plugin-react-refresh@2.4.1 [2021-03-19]

  • bea1c56c - Simplify. cleanup, enhance snowpack internals (#2707)
  • ca16821f - Parse multiline <body> tags (#2406) <Nahuel Greco>
  • 353da2cb - [ci] yarn format
  • f6b30dea - Disable react-refresh during ssr. (#2376) <Chris Thomas>