I've built an app that I'd like to deploy to netlify but it won't work. The app is a react vite app using typescript and chakra-ui. The build is succesful but I get a lot pf these errors: 'node_modules/@chakra-ui/button/dist/chunk-DA7QIPTJ.mjs (1:0) Module level directives cause errors when bundled, "use client" in "node_modules/@chakra-ui/button/dist/chunk-DA7QIPTJ.mjs" was ignored.'
It works fine when I run it locally with 'npm run dev' and also after the build with 'npm run preview' but I get the errors shown in the image after I deploy it to netlify.
The error I'm getting on the netlify page.
Can someone please help?
I've also tried deploying it to github pages and vercel but the same thing happens there.
npm run buildyou should produce a dist folder. Look at the index.html <head> and in the assets folder. Does your application work and just some scripts / assets are missing?