{"id":16185227,"url":"https://github.com/davemo/plugin-react-davemo","last_synced_at":"2025-04-07T13:13:21.895Z","repository":{"id":138658238,"uuid":"479839926","full_name":"davemo/plugin-react-davemo","owner":"davemo","description":"@vitejs/plugin-react forked to apply fix for the jsxDEV issue","archived":false,"fork":false,"pushed_at":"2022-04-09T20:46:50.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-04T12:07:56.787Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/davemo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-09T20:46:35.000Z","updated_at":"2022-04-09T20:46:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"7702e8e6-9d1a-4c72-99e1-1ac43d391d0e","html_url":"https://github.com/davemo/plugin-react-davemo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davemo%2Fplugin-react-davemo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davemo%2Fplugin-react-davemo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davemo%2Fplugin-react-davemo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davemo%2Fplugin-react-davemo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davemo","download_url":"https://codeload.github.com/davemo/plugin-react-davemo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247657271,"owners_count":20974345,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T07:13:49.624Z","updated_at":"2025-04-07T13:13:21.878Z","avatar_url":"https://github.com/davemo.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @vitejs/plugin-react [![npm](https://img.shields.io/npm/v/@vitejs/plugin-react.svg)](https://npmjs.com/package/@vitejs/plugin-react)\n\nThe all-in-one Vite plugin for React projects.\n\n- enable [Fast Refresh](https://www.npmjs.com/package/react-refresh) in development\n- use the [automatic JSX runtime](https://github.com/alloc/vite-react-jsx#faq)\n- avoid manual `import React` in `.jsx` and `.tsx` modules\n- dedupe the `react` and `react-dom` packages\n- use custom Babel plugins/presets\n\n```js\n// vite.config.js\nimport { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\n\nexport default defineConfig({\n  plugins: [react()]\n})\n```\n\n## Filter which files use Fast Refresh\n\nBy default, Fast Refresh is used by files ending with `.js`, `.jsx`, `.ts`, and `.tsx`, except for files with a `node_modules` parent directory.\n\nIn some situations, you may not want a file to act as a 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 a regex, a [picomatch](https://github.com/micromatch/picomatch#globbing-features) pattern, or an array of either. Files matching `include` and not `exclude` will use Fast Refresh. The defaults are always applied.\n\n```js\nreact({\n  // Exclude storybook stories\n  exclude: /\\.stories\\.(t|j)sx?$/,\n  // Only .tsx files\n  include: '**/*.tsx'\n})\n```\n\n## Opting out of the automatic JSX runtime\n\nBy default, the plugin uses the [automatic JSX runtime](https://github.com/alloc/vite-react-jsx#faq). However, if you encounter any issues, you may opt out using the `jsxRuntime` option.\n\n```js\nreact({\n  jsxRuntime: 'classic'\n})\n```\n\n## Babel configuration\n\nThe `babel` option lets you add plugins, presets, and [other configuration](https://babeljs.io/docs/en/options) to the Babel transformation performed on each JSX/TSX file.\n\n```js\nreact({\n  babel: {\n    presets: [...],\n    // Your plugins run before any built-in transform (eg: Fast Refresh)\n    plugins: [...],\n    // Use .babelrc files\n    babelrc: true,\n    // Use babel.config.js files\n    configFile: true,\n  }\n})\n```\n\n### Proposed syntax\n\nIf you are using ES syntax that are still in proposal status (e.g. class properties), you can selectively enable them with the `babel.parserOpts.plugins` option:\n\n```js\nreact({\n  babel: {\n    parserOpts: {\n      plugins: ['decorators-legacy']\n    }\n  }\n})\n```\n\nThis option does not enable _code transformation_. That is handled by esbuild.\n\n**Note:** TypeScript syntax is handled automatically.\n\nHere's the [complete list of Babel parser plugins](https://babeljs.io/docs/en/babel-parser#ecmascript-proposalshttpsgithubcombabelproposals).\n\n## Middleware mode\n\nIn [middleware mode](https://vitejs.dev/config/#server-middlewaremode), you should make sure your entry `index.html` file is transformed by Vite. Here's an example for an Express server:\n\n```js\napp.get('/', async (req, res, next) =\u003e {\n  try {\n    let html = fs.readFileSync(path.resolve(root, 'index.html'), 'utf-8')\n\n    // Transform HTML using Vite plugins.\n    html = await viteServer.transformIndexHtml(req.url, html)\n\n    res.send(html)\n  } catch (e) {\n    return next(e)\n  }\n})\n```\n\nOtherwise, you'll probably get this error:\n\n```\nUncaught Error: @vitejs/plugin-react can't detect preamble. Something is wrong.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavemo%2Fplugin-react-davemo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavemo%2Fplugin-react-davemo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavemo%2Fplugin-react-davemo/lists"}