vuepress / core

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

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

Closed Mister-Hope closed 6 months ago

Mister-Hope commented 6 months 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 6 months ago

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

Mister-Hope commented 6 months 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 6 months ago

Reproduced with e2e case.

meteorlxy commented 6 months 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 6 months ago

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