Gathering detailed insights and metrics for @vitejs/plugin-react-refresh
Gathering detailed insights and metrics for @vitejs/plugin-react-refresh
Gathering detailed insights and metrics for @vitejs/plugin-react-refresh
Gathering detailed insights and metrics for @vitejs/plugin-react-refresh
@vitejs/plugin-react
The default Vite plugin for React projects
@vitejs/plugin-react-swc
Speed up your Vite dev server with SWC
vite-plugin-react-refresh
Provide enhancements for @vitejs/plugin-react-refresh.
@knightly/vitejs__plugin-react-refresh
[](https://github.com/knightlyjs/knightly) 
Next generation frontend tooling. It's fast!
npm install @vitejs/plugin-react-refresh
Typescript
Module System
Min. Node Version
89.5
Supply Chain
87.5
Quality
80.7
Maintenance
100
Vulnerability
100
License
TypeScript (83.23%)
JavaScript (9.82%)
HTML (5.16%)
CSS (1.23%)
Vue (0.14%)
AppleScript (0.11%)
SCSS (0.1%)
Svelte (0.1%)
Less (0.05%)
Stylus (0.02%)
Shell (0.01%)
Pug (0.01%)
Sass (0.01%)
SugarSS (0.01%)
Total Downloads
14,387,441
Last Day
2,704
Last Week
56,313
Last Month
268,763
Last Year
3,719,912
MIT License
73,945 Stars
7,907 Commits
6,905 Forks
454 Watchers
44 Branches
1,126 Contributors
Updated on Jul 04, 2025
Minified
Minified + Gzipped
Latest Version
1.3.6
Package Id
@vitejs/plugin-react-refresh@1.3.6
Size
6.13 kB
Published on
Jul 27, 2021
Cumulative downloads
Total Downloads
Last Day
-49.9%
2,704
Compared to previous day
Last Week
-20.1%
56,313
Compared to previous week
Last Month
11.8%
268,763
Compared to previous month
Last Year
15.7%
3,719,912
Compared to previous year
Provides React Refresh support for Vite.
1// vite.config.js 2import reactRefresh from '@vitejs/plugin-react-refresh' 3 4export default { 5 plugins: [reactRefresh()] 6}
If you are using ES syntax that are still in proposal status (e.g. class properties), you can selectively enable them via the parserPlugins
option:
1export default { 2 plugins: [ 3 reactRefresh({ 4 parserPlugins: ['classProperties', 'classPrivateProperties'] 5 }) 6 ] 7}
Full list of Babel parser plugins.
By default, @vite/plugin-react-refresh will process files ending with .js
, .jsx
, .ts
, and .tsx
, and excludes all files in node_modules
.
In some situations you may not want a file to act as an HMR boundary, instead preferring that the changes propagate higher in the stack before being handled. In these cases, you can provide an include
and/or exclude
option, which can be regex or a picomatch pattern, or array of either. Files must match include and not exclude to be processed. Note, when using either include
, or exclude
, the defaults will not be merged in, so re-apply them if necessary.
1export default { 2 plugins: [ 3 reactRefresh({ 4 // Exclude storybook stories and node_modules 5 exclude: [/\.stories\.(t|j)sx?$/, /node_modules/], 6 // Only .tsx files 7 include: '**/*.tsx' 8 }) 9 ] 10}
If using TSX, any TS-supported syntax will already be transpiled away so you won't need to specify them here.
This option only enables the plugin to parse these syntax - it does not perform any transpilation since this plugin is dev-only.
If you wish to transpile the syntax for production, you will need to configure the transform separately using @rollup/plugin-babel as a build-only plugin.
When Vite is launched in Middleware Mode, you need to make sure your entry index.html
file is transformed with ViteDevServer.transformIndexHtml
. Otherwise, you may get an error prompting Uncaught Error: @vitejs/plugin-react-refresh can't detect preamble. Something is wrong.
To mitigate this issue, you can explicitly transform your index.html
like this when configuring your express server:
1app.get('/', async (req, res, next) => {
2 try {
3 let html = fs.readFileSync(path.resolve(root, 'index.html'), 'utf-8')
4 html = await viteServer.transformIndexHtml(req.url, html)
5 res.send(html)
6 } catch (e) {
7 return next(e)
8 }
9})
No vulnerabilities found.
Reason
30 commit(s) and 17 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
2 existing vulnerabilities detected
Details
Reason
Found 21/27 approved changesets -- score normalized to 7
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
binaries present in source code
Details
Reason
dependency not pinned by hash detected -- score normalized to 6
Details
Reason
SAST tool is not run on all commits -- score normalized to 3
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Score
Last Scanned on 2025-06-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More