Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: revert #5902, fix #8243 #8654

Merged
merged 2 commits into from Jun 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test was failing with #5902 when cssCodeSplit=true. (cssCodeSplit is set to false in vite.config.js)

})

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.