vuejs / pinia

🍍 Intuitive, type safe, light and flexible Store for Vue using the composition api with DevTools support
https://pinia.vuejs.org
MIT License
13.11k stars 1.05k forks source link

"Unexpected token ';'" error when running the build. #2725

Closed vinoddotcom closed 3 months ago

vinoddotcom commented 3 months ago

Reproduction

https://stackblitz.com/edit/github-tmvhj9?file=package.json

Steps to reproduce the bug

Go to the terminal and run

  1. npm run clear-cache
  2. npm run build
  3. npm run preview

see the issue

refer => https://github.com/nuxt/nuxt/issues/28293

Expected behavior

The build preview should run without any errors.

Actual behavior

While running the build, I got an error

[nuxt] [request error] [unhandled] [500] Unexpected token ';' at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:168:18)
at callTranslator (node:internal/modules/esm/loader:279:14)
at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:285:30)
at async link (node:internal/modules/esm/module_job:78:21) [nuxt] [request error] [unhandled] [500] Unexpected token ';' at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:168:18)
at callTranslator (node:internal/modules/esm/loader:279:14)
at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:285:30)
at async link (node:internal/modules/esm/module_job:78:21)

Additional information

While using Pinia with Nuxt, the production build throws an error: 'nuxt] [request error] [unhandled] [500] Unexpected token ';''.

Upon investigation, I found the error in .output/server/chunks/build/server.mjs.

However, I tried to fix the problem by downgrading packages using vite@5.31, nuxt/vite-builder@3.12.2, nuxt@3.12.2 and nuxt/kit@3.12.0. Unfortunately, I was unable to resolve the issue.

Screenshot from 2024-07-24 13-41-42 Screenshot from 2024-07-24 13-42-28

vinoddotcom commented 3 months ago

By updating pinia @2.1.7 to @2.1.8-beta.0, the issue was resolved.

posva commented 3 months ago

It works with 2.2.0