Skip to content

Commit 0b7aaed

Browse files
authored
feat(css): support lightningcss plugin dependency (#21748)
1 parent 3fbb55a commit 0b7aaed

6 files changed

Lines changed: 478 additions & 496 deletions

File tree

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3347,6 +3347,24 @@ async function compileLightningCSS(
33473347
let css = decoder.decode(res.code)
33483348
for (const dep of res.dependencies!) {
33493349
switch (dep.type) {
3350+
case 'file': {
3351+
deps.add(dep.filePath)
3352+
break
3353+
}
3354+
case 'glob': {
3355+
for (const file of globSync(dep.glob)) {
3356+
deps.add(file)
3357+
}
3358+
const files = globSync(dep.glob, {
3359+
absolute: true,
3360+
expandDirectories: false,
3361+
ignore: ['**/node_modules/**'],
3362+
})
3363+
for (let i = 0; i < files.length; i++) {
3364+
deps.add(files[i])
3365+
}
3366+
break
3367+
}
33503368
case 'url': {
33513369
let replaceUrl: string
33523370
if (skipUrlReplacer(dep.url)) {
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
import { tests } from './tests'
2-
3-
tests(false)
1+
import './tests'
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
// NOTE: a separate directory from `playground/css` is created by playground/vitestGlobalSetup.ts
2-
import { tests } from '../tests'
3-
4-
tests(true)
2+
import '../tests'

0 commit comments

Comments
 (0)