Comments (7)
I'm not familiar with React (nor the vite plugin) so I can't say for sure if there are caveats to this. @aleclarson might know more about it.
from vite-plugin-react.
Hi!
Yes that's a limitation of the current API. Making this change non breaking would make the API unusable so I plan to change this in the next major with #53, hopefully in less than one month
from vite-plugin-react.
please give more details.
what exactly are you trying to do and how do you expect it to work
from vite-plugin-react.
@Niputi
I wrote a Vite plugin to transform markdown to React component. The output of the plugin looks something like this:
export default () => <div> {/* The transformed code */}</div>
However, @vitejs/plugin-react
could not accept a .md
file and I had to use babel to transform the jsx to js.
This is my current configuration file:
plugins: [
vitePluginDocs(), // my markdown transform plugin
babel({
extensions: ['.md'],
configFile: false,
presets: [['@babel/preset-react', { runtime: 'automatic' }]],
babelHelpers: 'bundled'
})
viteReact()
]
I want the @vitejs/plugin-react
to accept an extra parameter to accept more file's format like this:
plugins: [
vitePluginDocs(), // my markdown transform plugin
viteReact({ extensions: ['.tsx', '.md'], })
]
So I can remove the babel from my config.
from vite-plugin-react.
By reading the plugin's code, I found that the plugin will only convert mjs | js | jsx | ts | tsx
file
from vite-plugin-react.
vite-plugin-svelte
has a similar feature too that allows specifying the extensions. Probably worth nothing a caveat though: sveltejs/vite-plugin-svelte#60
from vite-plugin-react.
@bluwy I think it's a nice feature, so what do you think?
from vite-plugin-react.
Related Issues (20)
- Uncaught SyntaxError: The requested module '/node_modules/prop-types/index.js?v=cf7fa801' does not provide an export named 'default HOT 3
- Update plugin to the new version of Vite 5.x HOT 12
- [bug]:at the time of installing the react vite app,it is not runnit HOT 1
- Babel reformats the input file, causing source references to be wrong HOT 8
- Decorators not working with React class components HOT 2
- Vite react-admin browser dev tools freeze (100% CPU) HOT 2
- React hooks reran on every edit HOT 6
- Error when using block comments in JSX: "repeat count must be non-negative" HOT 2
- Errors in react App.tsx file HOT 2
- Having "react" in optimizeDeps.include creates problems when "react" is externalized HOT 3
- Fast refresh without babel HOT 3
- Getting syntax error on react-redux-snackbar HOT 1
- Remove usage of Vite dedupe option
- Vite on M1 pro - This localhost page canβt be found HOT 2
- [plugin:vite:esbuild] This service is no longer running HOT 3
- HMR improvements for .ts files that include jsx
- Default ESLint setup ignores JSX files if you run `npx eslint .` HOT 3
- Injecting Preamble not possible when using `renderToPipeableStream`. HOT 2
- inject css in shadowDom HOT 1
- Does the React plugin not support React 16? I couldn't find related documentation. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vite-plugin-react.