I'm using the @remote-ui/react library to render my React code in a web worker. I'm using Vite for my project, but whenever I try to use JSX in my worker script, I see the following error:
Uncaught Error: @vitejs/plugin-react can't detect preamble. Something is wrong. See https://github.com/vitejs/vite-plugin-react/pull/11#discussion_r430879201
I've created a minimal reproduction here .
Disabling React Fast Refresh seems to do the trick:
// vite config
{
plugins: [react({ fastRefresh: false })],
worker: {
plugins: [react()],
},
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.