Skip to content

Commit

Permalink
fix: revert #5902, fix #8243 (#8654)
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red committed Jun 19, 2022
1 parent 9a1c1ae commit 1b820da
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 52 deletions.
8 changes: 2 additions & 6 deletions packages/vite/src/node/plugins/css.ts
Expand Up @@ -492,11 +492,7 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
// this is a shared CSS-only chunk that is empty.
pureCssChunks.add(chunk.fileName)
}
if (
opts.format === 'es' ||
opts.format === 'cjs' ||
opts.format === 'system'
) {
if (opts.format === 'es' || opts.format === 'cjs') {
const cssAssetName = chunk.name + '.css'

chunkCSS = resolveAssetUrlsInCss(chunkCSS, cssAssetName)
Expand Down Expand Up @@ -558,7 +554,7 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
.join('|')
.replace(/\./g, '\\.')
const emptyChunkRE = new RegExp(
opts.format === 'es' || opts.format === 'system'
opts.format === 'es'
? `\\bimport\\s*["'][^"']*(?:${emptyChunkFiles})["'];\n?`
: `\\brequire\\(\\s*["'][^"']*(?:${emptyChunkFiles})["']\\);\n?`,
'g'
Expand Down
7 changes: 1 addition & 6 deletions playground/legacy/__tests__/legacy.spec.ts
Expand Up @@ -60,12 +60,7 @@ test('correctly emits styles', async () => {
// dynamic import css
test('should load dynamic import with css', async () => {
await page.click('#dynamic-css-button')
await untilUpdated(
() =>
page.$eval('#dynamic-css', (node) => window.getComputedStyle(node).color),
'rgb(255, 0, 0)',
true
)
await untilUpdated(() => getColor('#dynamic-css'), 'red', true)
})

describe.runIf(isBuild)('build', () => {
Expand Down
1 change: 0 additions & 1 deletion playground/legacy/package.json
Expand Up @@ -6,7 +6,6 @@
"dev": "vite",
"build": "vite build --debug legacy",
"build:custom-filename": "vite --config ./vite.config-custom-filename.js build --debug legacy",
"build:dynamic-css": "vite --config ./vite.config-dynamic-css.js build --debug legacy",
"build:multiple-output": "vite --config ./vite.config-multiple-output.js build",
"debug": "node --inspect-brk ../../packages/vite/bin/vite",
"preview": "vite preview"
Expand Down
39 changes: 0 additions & 39 deletions playground/legacy/vite.config-dynamic-css.js

This file was deleted.

0 comments on commit 1b820da

Please sign in to comment.