Skip to content

Commit

Permalink
fix class component unable to hot reload
Browse files Browse the repository at this point in the history
  • Loading branch information
Hare Prananda committed Jul 30, 2023
1 parent cbdf19f commit eebb022
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/plugin-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vitejs/plugin-react",
"version": "4.0.3",
"name": "@hareprnd/vite-plugin-react",
"version": "0.1.0",
"license": "MIT",
"author": "Evan You",
"contributors": [
Expand Down
5 changes: 5 additions & 0 deletions packages/plugin-react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
parserPlugins.push('typescript')
}

// eslint-disable-next-line regexp/no-unused-capturing-group
if (/(ts|js)x$/.test(id) && !isProduction) {
code = `const Vite____ = () => {};` + code
}

const result = await babel.transformAsync(code, {
...babelOptions,
root: projectRoot,
Expand Down

0 comments on commit eebb022

Please sign in to comment.