user2443507
user2443507

Reputation: 393

Why is vite throwing a 'Failed to parse source' error?

I cannot access content in a JavaScript (.js) file. Vite throws:

[vite] Internal server error: Failed to parse source for import analysis because the content contains invalid JS syntax. If you are using JSX, make sure to name the file with the .jsx or .tsx extension.

Creating the vite.confis.js with the suggested content has no effect. If I remove the first line causing the error, the next import statement causes the same error.

Any ideas on how to correct this?

enter image description here

Upvotes: 0

Views: 12464

Answers (1)

user2443507
user2443507

Reputation: 393

This error was due to a very stupid mistake - a function which was not fully closed by a brace. I am surprised that eslint did not indicate an error.

enter image description here

Upvotes: 13

Related Questions