mirror of
https://github.com/vitejs/vite.git
synced 2024-11-21 22:59:10 +00:00
fix(css): dont remove JS chunk for pure CSS chunk when the export is used (#18307)
This commit is contained in:
parent
b382f7e19c
commit
889bfc0ada
@ -568,7 +568,7 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
|
||||
let chunkCSS = ''
|
||||
// the chunk is empty if it's a dynamic entry chunk that only contains a CSS import
|
||||
const isJsChunkEmpty = code === '' && !chunk.isEntry
|
||||
let isPureCssChunk = true
|
||||
let isPureCssChunk = chunk.exports.length === 0
|
||||
const ids = Object.keys(chunk.modules)
|
||||
for (const id of ids) {
|
||||
if (styles.has(id)) {
|
||||
|
@ -24,5 +24,14 @@ export default defineConfig({
|
||||
},
|
||||
build: {
|
||||
sourcemap: true,
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks(id) {
|
||||
if (id.includes('foo.css')) {
|
||||
return 'foo_css'
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user