Skip to content

Commit

Permalink
fix: remove empty chunk css imports when using esnext (#8345)
Browse files Browse the repository at this point in the history
Co-authored-by: 翠 / green <green@sapphi.red>
  • Loading branch information
matthewp and sapphi-red authored Jun 1, 2022
1 parent 5a57626 commit b3d9652
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/vite/src/node/plugins/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -558,8 +558,8 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
.replace(/\./g, '\\.')
const emptyChunkRE = new RegExp(
opts.format === 'es' || opts.format === 'system'
? `\\bimport\\s*"[^"]*(?:${emptyChunkFiles})";\n?`
: `\\brequire\\(\\s*"[^"]*(?:${emptyChunkFiles})"\\);\n?`,
? `\\bimport\\s*["'][^"']*(?:${emptyChunkFiles})["'];\n?`
: `\\brequire\\(\\s*["'][^"']*(?:${emptyChunkFiles})["']\\);\n?`,
'g'
)
for (const file in bundle) {
Expand Down

0 comments on commit b3d9652

Please sign in to comment.