Skip to content

Commit 1b820da

Browse files
authored
fix: revert #5902, fix #8243 (#8654)
1 parent 9a1c1ae commit 1b820da

File tree

4 files changed

+3
-52
lines changed

4 files changed

+3
-52
lines changed

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

+2-6
Original file line numberDiff line numberDiff line change
@@ -492,11 +492,7 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
492492
// this is a shared CSS-only chunk that is empty.
493493
pureCssChunks.add(chunk.fileName)
494494
}
495-
if (
496-
opts.format === 'es' ||
497-
opts.format === 'cjs' ||
498-
opts.format === 'system'
499-
) {
495+
if (opts.format === 'es' || opts.format === 'cjs') {
500496
const cssAssetName = chunk.name + '.css'
501497

502498
chunkCSS = resolveAssetUrlsInCss(chunkCSS, cssAssetName)
@@ -558,7 +554,7 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
558554
.join('|')
559555
.replace(/\./g, '\\.')
560556
const emptyChunkRE = new RegExp(
561-
opts.format === 'es' || opts.format === 'system'
557+
opts.format === 'es'
562558
? `\\bimport\\s*["'][^"']*(?:${emptyChunkFiles})["'];\n?`
563559
: `\\brequire\\(\\s*["'][^"']*(?:${emptyChunkFiles})["']\\);\n?`,
564560
'g'

playground/legacy/__tests__/legacy.spec.ts

+1-6
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,7 @@ test('correctly emits styles', async () => {
6060
// dynamic import css
6161
test('should load dynamic import with css', async () => {
6262
await page.click('#dynamic-css-button')
63-
await untilUpdated(
64-
() =>
65-
page.$eval('#dynamic-css', (node) => window.getComputedStyle(node).color),
66-
'rgb(255, 0, 0)',
67-
true
68-
)
63+
await untilUpdated(() => getColor('#dynamic-css'), 'red', true)
6964
})
7065

7166
describe.runIf(isBuild)('build', () => {

playground/legacy/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"dev": "vite",
77
"build": "vite build --debug legacy",
88
"build:custom-filename": "vite --config ./vite.config-custom-filename.js build --debug legacy",
9-
"build:dynamic-css": "vite --config ./vite.config-dynamic-css.js build --debug legacy",
109
"build:multiple-output": "vite --config ./vite.config-multiple-output.js build",
1110
"debug": "node --inspect-brk ../../packages/vite/bin/vite",
1211
"preview": "vite preview"

playground/legacy/vite.config-dynamic-css.js

-39
This file was deleted.

0 commit comments

Comments
 (0)