File tree 2 files changed +9
-6
lines changed
packages/vite/src/node/plugins
2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -426,7 +426,11 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
426
426
code = `export default ${ JSON . stringify ( content ) } `
427
427
}
428
428
} else {
429
- code = `export default ''`
429
+ // if moduleCode exists return it **even if** it does not have `?used`
430
+ // this will disable tree-shake to work with `import './foo.module.css'` but this usually does not happen
431
+ // this is a limitation of the current approach by `?used` to make tree-shake work
432
+ // See #8936 for more details
433
+ code = modulesCode || `export default ''`
430
434
}
431
435
432
436
return {
Original file line number Diff line number Diff line change @@ -349,8 +349,7 @@ test('PostCSS dir-dependency', async () => {
349
349
}
350
350
} )
351
351
352
- // skip because #8278 is reverted
353
- test . skip ( 'import dependency includes css import' , async ( ) => {
352
+ test ( 'import dependency includes css import' , async ( ) => {
354
353
expect ( await getColor ( '.css-js-dep' ) ) . toBe ( 'green' )
355
354
expect ( await getColor ( '.css-js-dep-module' ) ) . toBe ( 'green' )
356
355
} )
@@ -437,9 +436,9 @@ test('PostCSS source.input.from includes query', async () => {
437
436
)
438
437
} )
439
438
440
- // skip because #8278 is reverted
441
- test . skip ( 'aliased css has content' , async ( ) => {
439
+ test ( 'aliased css has content' , async ( ) => {
442
440
expect ( await getColor ( '.aliased' ) ) . toBe ( 'blue' )
443
- expect ( await page . textContent ( '.aliased-content' ) ) . toMatch ( '.aliased' )
441
+ // skipped: currently not supported see #8936
442
+ // expect(await page.textContent('.aliased-content')).toMatch('.aliased')
444
443
expect ( await getColor ( '.aliased-module' ) ) . toBe ( 'blue' )
445
444
} )
You can’t perform that action at this time.
0 commit comments