Tag Archives: Failed to parse source for import analysis because the content contains invalid JS syntax

Failed to parse source for import analysis because the content contains invalid JS syntax

Vue3 compiles with an error when using compositionAPI:
[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.
The reason I encountered the error reported was because

async setup(props) { // Async asynchronous keyword in front of setup needs to be aware of the risk of blocking
    
 
    await XXXX; // After await, asynchronous blocking causes an error to be reported
}

It’s best to write directly with vue3 script setup syntax   Vue3 script setup syntax