Closed philholden closed 7 months ago
This has to to with React still using commonjs, but I haven't encountered the issue you're describing. In my tests Vite was able to handle the react imports.
Could you try to recreate the bug on Stackblitz?
Thanks. I had a go but ran into some different errors on StackBlitz. Would you be able to get it running with SvleteKit 1.x on StackBlitz. Just default install with one react HelloWorld component on a route?
https://stackblitz.com/edit/sveltejs-kit-template-default-4ammlw?file=vite.config.js&terminal=dev
If I can start from something that works I can then see where I am breaking things.
Saw some (golang?) errors I haven't seen before on StackBlitz (had to refresh 2 times)
I've created a basic example here:
Thanks
I think my problem was using it with vitePreprocess
which it is meant to replace this is currently the default rather than sveltePreprocess
. So it was not clear that I needed to replace vitePreprocess
with sveltePreprocessReact
. By reading the docs it looked to me like you needed vitePreprocess
for TypeScript so I did not try removing it.
Thanks again for taking time to do this all working now. noExternal: true
in vite.config
was also breaking this.
// ssr: {
// noExternal: true
// },
Getting the following error:
svelte config:
vite.config (commented out lines are things I have tried):
Any thoughts?