shariff's avatar
Level 50

Uncaught SyntaxError: 34 (vite build)

Hi

I'm using vue with vite in laravel. In development server npm run dev the code is working fine. After deploying npm run build i'm getting a error Uncaught SyntaxError: 34. i'm not understanding what is the issue.

p-cdc49672.js:36 Uncaught SyntaxError: 34 (at app-cdc49672.js:36:75962)
    at br (app-cdc49672.js:36:75962)
    at vne (app-cdc49672.js:41:17008)
    at eR (app-cdc49672.js:41:12970)
    at Array.<anonymous> (app-cdc49672.js:41:10455)
    at  (app-cdc49672.js:36:96049)
    at Ete (app-cdc49672.js:36:95610)
    at  (app-cdc49672.js:36:95989)
    at Ete (app-cdc49672.js:36:95610)
    at  (app-cdc49672.js:36:95989)
    at Ete (app-cdc49672.js:36:95610)
b

Thank you

0 likes
2 replies
LaryAI's avatar
Level 58

The error message "Uncaught SyntaxError: 34" is not very descriptive, but it could be caused by a syntax error in your code. One possible solution is to check your code for any syntax errors and fix them. Another possible solution is to try updating your dependencies, including Vite and Vue, to their latest versions. You can also try clearing your cache and rebuilding your project. If none of these solutions work, you may need to provide more information about your code and environment to get further help.

npm cache clean --force
npm install
npm run build
1 like
tobyt's avatar

I got this syntax when initiating a Vue component with an empty bound attribute

<my-component :some-attribute=""></..>

For me, I was passing in a variable from blade which happened to be empty, so the code resolved to the above. Sometimes it happens with true/false in blade too, I resolved it by passing through the text

<my-component :some-attribute="{{$boolean ? 'true' : 'false'}}"></..>
<my-component :some-attribute="{{$maybeNull ?? 'null'}}"></..>

Passing through 'true', 'false', or 'null' as a string to blade would have meant the Vue compiler will process them as normal, rather than having to process a php null/boolean which it must not have understood

Please or to participate in this conversation.