pmndrs / react-three-editor

🔌 A one of a kind scene editor that writes changes back into your code
MIT License
621 stars 40 forks source link

Error when using `@vitejs/plugin-react-swc` #19

Open krispya opened 1 year ago

krispya commented 1 year ago

I get the following error when attempting to start up the editor: image

My vite.config:

import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
import { r3f } from "@react-three/editor/vite";

// https://vitejs.dev/config/
export default defineConfig((env) => ({
  plugins: [env.command === "build" ? react() : r3f()],
}));

I am on Windows. I am using Vite v4.0.0.

krispya commented 1 year ago

I confirmed that vite v4 does work. The problem is using @vitejs/plugin-react-swc insead of @vitejs/plugin-react.

nksaraf commented 1 year ago

So the earlier error was vite 4 + swc and works with vite 4 + babel.. did u try with vite 3 as well?

krispya commented 1 year ago

I did not, I can try this configuration later.

nksaraf commented 1 year ago

https://github.com/vitejs/vite/issues/9986 could be related to this

wanghqwe commented 1 year ago
resolve: {
   preserveSymlinks: true,
},

work for me

prjwlbadwe commented 1 year ago
  1. Open Command Palette: Command + Shift + P.
  2. Search TypeScript: Restart TS server.
  3. Press Enter.
AlejandroWogelman commented 1 year ago

I confirmed that vite v4 does work. The problem is using @vitejs/plugin-react-swc insead of @vitejs/plugin-react.

Thanks!! I had the following error "[vite] Internal server error: Bindings not found." Changing @vitejs/plugin-react-swc to @vitejs/plugin-react solved it.