vitejs / vite-plugin-vue

Vite Vue Plugins
MIT License
501 stars 155 forks source link

reactivity breaking Nuxt 3 + I18n module reproduction when running in StackBlitz #474

Open userquin opened 1 week ago

userquin commented 1 week ago

Related plugins

Describe the bug

The compiler is missing, buildStart mutating the compiler but options is a shallowRef. The SB reproduction will fail with any package manager.

On local it works, only failing on StackBlitz, breaking any Nuxt + I18n reproduction...

You can check this repository using pnpm (instead npm) patching the Vue plugin to initialize the compiler properly in the configResolved hook:

Link to SB in the readme file: https://github.com/userquin/nuxt3-starter-patched-vue-plugin

I'm going to send a PR to fix this.

Reproduction

https://github.com/userquin/nuxt3-starter-patched-vue-plugin

Steps to reproduce

Just open the URL and await Nuxt start dev server.

System Info

❯ npx envinfo --system --npmPackages '{vite,@vitejs/*}' --binaries --browsers
Need to install the following packages:
envinfo@7.14.0
Ok to proceed? (y) 

  System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.20.3 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm

Used Package Manager

npm

Logs

ℹ Compiled plugins.server.mjs in 710.21ms                                             15:55:47
ℹ Compiled plugins.client.mjs in 732.65ms                                             15:55:47
ℹ Compiled types/plugins.d.ts in 738.38ms                                             15:55:47
✔ Vite client built in 707ms                                                          15:55:48

 ERROR  Pre-transform error: Cannot read properties of null (reading 'parse')          15:55:48

 ERROR  Pre-transform error: Cannot read properties of null (reading 'parse') (x2)     15:55:49

✔ Vite server built in 1223ms                                                         15:55:49
✔ Nuxt Nitro server built in 2642 ms                                            nitro 15:55:53
ℹ Vite client warmed up in 0ms                                                        15:55:53
ℹ Vite server warmed up in 1263ms

Validations