vuejs / pinia

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

pinia tries to import default export from vue package #2569

Closed starlys closed 7 months ago

starlys commented 7 months ago

Reproduction

none

Steps to reproduce the bug

Using vue 3.4.15, vite 5.0.4, and pinia 2.1.7.

Vite config includes the following to internalize pinia and externalize vue. noExternal: true, external: { 'vue' ....}

Then build for SSR: npx vite -ssr ./output-path

Expected behavior

The resulting SSR output will include a line like: import { ....} from 'vue';

Actual behavior

The resulting SSR output include a line like: import $require0, { ....} from 'vue'; where the variable $require0 is used only in the pinia code.

The problem with this is that the vue package does not have a default export, so the SSR code does not run.

Additional information

A workaround is to externalize pinia, but ideally pinia would not expect vue package to have a default export.