vite: Build Error: [rollup-plugin-dynamic-import-variables] Unexpected token

⚠️ IMPORTANT ⚠️ Please do not ignore this template. If you do, your issue will be closed immediately.

Describe the bug

can no build this project

Reproduction

https://github.com/HenryWong-fe/vite-project

System Info

  • vite version: ^2.0.0
  • Operating System: mac os 10.15.4
  • Node version: v14.15.1
  • Package manager (npm/yarn/pnpm) and version: npm 6.14.8

Logs (Optional if provided reproduction)

image

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 6
  • Comments: 18 (2 by maintainers)

Most upvoted comments

I’m facing the same issue too while running npm run build

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.