@trevorpan I'm facing the same issue. Did you find any solution for this?
Uncaught SyntaxError: 34 - Vite in production error
Hello,
new SyntaxError(String(s)) / {return"AxiosHeaders"}
Having quite a time with npm run build, vite and laravel 9 on production.
I've read a few posts where some people build assets locally and then deploy. Others build assets on their production server.
When developing locally I can see all the assets just fine. When running build however images are not found, fonts are versioned but not found, and I keep getting this pesky new SyntaxError(String(s)) in the console which causes the build to possibly flash a portion of the page, then the page becomes a white screen only.
Any ideas?
@shariff Hi, yes. This was an issue where I had to declare VITE_USER_NODE_ENV="production" in a .env.production file.
Make sure production is surrounded by quotes. That was thing that killed me; I kept thinking VITE_USER_NODE_ENV=production would be correct, but vite doesn't interpret it as a string.
Also in vite.config.js use sourcemaps.
if (command === 'dev') {
return {
... // your stuff
build: {
...
sourcemap: 'inline',
...
},
../
} else {
// if (command === 'build')
return {
....
that will make that pita go away!
Please or to participate in this conversation.