Skip to content

Commit 9fbc1a9

Browse files
matthewppatak-dev
authored andcommitted
fix: backport remove empty chunk css imports when using esnext (#8345)
1 parent dfe4307 commit 9fbc1a9

File tree

1 file changed

+2
-2
lines changed
  • packages/vite/src/node/plugins

1 file changed

+2
-2
lines changed

packages/vite/src/node/plugins/css.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -518,8 +518,8 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
518518
.replace(/\./g, '\\.')
519519
const emptyChunkRE = new RegExp(
520520
opts.format === 'es'
521-
? `\\bimport\\s*"[^"]*(?:${emptyChunkFiles})";\n?`
522-
: `\\brequire\\(\\s*"[^"]*(?:${emptyChunkFiles})"\\);\n?`,
521+
? `\\bimport\\s*["'][^"']*(?:${emptyChunkFiles})["'];\n?`
522+
: `\\brequire\\(\\s*["'][^"']*(?:${emptyChunkFiles})["']\\);\n?`,
523523
'g'
524524
)
525525
for (const file in bundle) {

0 commit comments

Comments
 (0)