Closed ianschmitz closed 1 year ago
The second error is cause by the first one. That's difficult to know why it happened without a reproduction
Closing as can't reproduce. Feel free to reopen if you have a repro.
this problem maybe cause by some other vite plugin in your project assigning a value to globalThis.__dirname same like this
@ArnaudBarre It may not be necessary to check globalThis.__dirname
just use dirname(fileURLToPath(import.meta.url))
directly?
This is for cjs compatibility. I need to check but I think import.meta.url
is not defined.
This is also what antfu uses: https://antfu.me/posts/isomorphic-dirname
This issue for me would be to override a variable with a very specific meaning in cjs. What's the goal of this?
I just got this today, using a fresh vite repo
@quantuminformation @ianschmitz @ArnaudBarre @enpitsuLin @yyx990803 did anyone ever find an solution to this. I'm facing it now and it's a booger. 👻
Had to put the Vite migration from Webpack on hold because of this 🥲
@quantuminformation, does your repo you linked (https://github.com/quantuminformation/chatgpt-youtube) reproduce the error for @ArnaudBarre to check out?
@mikeumus There can be a lot of reason that causes this issue. Try to understand what file causes the issue and what is special about it and reproduce it starting from a new Vite + react-swc template
Also please don't ping Evan like that, we can't do anything if you just say I have this issue
Hi all! 👋
While migrating to Vite 4, i decided i would try this plugin as a replacement of
@vitejs/plugin-react
. When trying to load the page i get the following error:Swapping back to
plugin-react
fixes the error. Let me know if there's any specific information i can provide to help debug!