-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build Error: [rollup-plugin-dynamic-import-variables] Unexpected token #2330
Comments
Hi, |
There are too few error messages to locate accurately。I found a related bug in issue, but it has been fixed,It's not clear what caused the build error。 |
Did you solve this issue? |
Hi, vite.config: build: { |
Added in vite config file as you have suggested but no luck when deployed to the server. It's giving the same error! I have attached both code and error. Please check and suggest if possible. Thanks |
@rollup/plugin-dynamic-import-vars is already included in Vite. The repro is too big to test a particular issue and it is currently outdated. Please open a new issue with a minimal reproduction against the latest Vite version if you still have a problem. |
This is possibly caused because you did not load the My guess is that without it the SFC is not parsed correctly and top level imports are wrongly handled as dynamic imports, thus causing the error. Loading the plugin fixed the problem for me. |
This can also happen if you are using Typescript and building with "vue-tsc --noEmit && vite build" but you've somehow managed to emit a JS copy of vite.config.ts to disk. Check for vite.config.js, delete and rerun. |
Hi,I have the same error and the suggestions above doesn't work for me. Did you fixed it? |
I'm facing the same issue too while running |
I'm facing the same issue too while running npm run build |
Same issue - has anyone found a solution? It happens when I upgrade from vite@2.2.1 -> vite@2.3.4 |
I'm facing this issue as well.
Files that are directly in the Edit: this seems a limitation of |
Same here on latest Vite while running |
If you happen to be running into this with Svelte, a workaround was suggested here. I was getting build errors on .svelte pages that have a style tag and use an environmental variable via import.meta.env. |
For me, I mistakenly named my file .js instead of .jsx. It was kind enough to tell me the file causing the error. |
This issue has been locked since it has been closed for more than 14 days. If you have found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Vite version. If you have any other comments you should join the chat at Vite Land or create a new discussion. |
Describe the bug
can no build this project
Reproduction
https://github.com/HenryWong-fe/vite-project
System Info
vite
version: ^2.0.0Logs (Optional if provided reproduction)
The text was updated successfully, but these errors were encountered: