vuepress / core

Vue-Powered Static Site Generator
https://vuepress.vuejs.org
MIT License
2.16k stars 922 forks source link

[Bug report] vite 5.2.12 failed to build dynamic imported style files #1573

Closed Mister-Hope closed 1 month ago

Mister-Hope commented 1 month ago

Description

When building with vite 5.2.12, vuepress failed to externalize style imports like css or scss while preforming SSG

Reproduction

This is confirmed in our ecosystem and we are using pnpm.overrides to downgrade to 5.2.11

Used Package Manager

pnpm

Workaround for anyone

Use vite 5.2.11

meteorlxy commented 1 month ago

Could you provide a reproduction based on our e2e? I could not reproduce it by 19e4d40

Mister-Hope commented 1 month ago

Could you provide a reproduction based on our e2e? I could not reproduce it by 19e4d40

The file should from a package, and it's imported using import()

import('@docsearch/css')
// or
import('@waline/client/waline-meta.css')

I am not sure if relative style files can cause this.

This is likely to be a Vite bug, but a normal Vite app do not have SSG process, so I have no idea making a minimal reproducion

meteorlxy commented 1 month ago

Reproduced with e2e case.

meteorlxy commented 1 month ago

@Mister-Hope - I've exclude vite 5.2.12 as a workaround for now.

Alternatively, you may consider replacing the dynamic import with static import

meteorlxy commented 1 month ago

https://github.com/vitejs/vite/issues/17366