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.
You set the base in your vite config. Which you can use to define a prefix for all your assets. Once you remove it your linked assets in your html
file should work.
base
in your vite config base: "/game-discovery/",
npm run build