Skip to content

Commit aa85931

Browse files
feat: add Vite 7 support to the @tailwindcss/vite plugin (#18384)
Closes #18381 * [Changelog for Vite 7.0.0 (2025-06-24)](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md#700-2025-06-24) Starting from Vite 7, Node 18 support will be dropped, which doesn't really affect Tailwind. It might be worth mentioning in the documentation that the recommended minimum Node versions are 20.19 and 22.12. Vite 7 is only available in ESM format, which is also not an issue. Vite's browser support aligns with the v4 guidelines: ``` Chrome 87 → 107 (tw: 111) Edge 88 → 107 (tw: 111) Firefox 78 → 104 (tw: 128) Safari 14.0 → 16.0 (tw: 16.4) ``` * [Vite 7 - Browser Support](https://vite.dev/guide/migration.html#default-browser-target-change) * [Tailwind CSS v4 - Browser Support](https://tailwindcss.com/docs/compatibility#browser-support) So, at first glance, there's nothing more to do except enabling support for these versions. --------- Co-authored-by: Jordan Pittman <[email protected]>
1 parent b9007dd commit aa85931

19 files changed

+436
-409
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
- Add heuristic to skip candidate migrations inside `emit(…)` ([#18330](https://github.com/tailwindlabs/tailwindcss/pull/18330))
1111
- Extract candidates with variants in Clojure/ClojureScript keywords ([#18338](https://github.com/tailwindlabs/tailwindcss/pull/18338))
1212
- Document `--watch=always` in the CLI's usage ([#18337](https://github.com/tailwindlabs/tailwindcss/pull/18337))
13+
- Add support for Vite 7 to `@tailwindcss/vite` ([#18384](https://github.com/tailwindlabs/tailwindcss/pull/18384))
1314

1415
## [4.1.10] - 2025-06-11
1516

integrations/vite/config.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ test(
1212
"tailwindcss": "workspace:^"
1313
},
1414
"devDependencies": {
15-
"vite": "^6"
15+
"vite": "^7"
1616
}
1717
}
1818
`,
@@ -76,7 +76,7 @@ test(
7676
"tailwindcss": "workspace:^"
7777
},
7878
"devDependencies": {
79-
"vite": "^6"
79+
"vite": "^7"
8080
}
8181
}
8282
`,
@@ -140,7 +140,7 @@ test(
140140
"tailwindcss": "workspace:^"
141141
},
142142
"devDependencies": {
143-
"vite": "^6"
143+
"vite": "^7"
144144
}
145145
}
146146
`,
@@ -219,7 +219,7 @@ test(
219219
"tailwindcss": "workspace:^"
220220
},
221221
"devDependencies": {
222-
"vite": "^6"
222+
"vite": "^7"
223223
}
224224
}
225225
`,

integrations/vite/css-modules.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe.each(['postcss', 'lightningcss'])('%s', (transformer) => {
1515
},
1616
"devDependencies": {
1717
${transformer === 'lightningcss' ? `"lightningcss": "^1",` : ''}
18-
"vite": "^6"
18+
"vite": "^7"
1919
}
2020
}
2121
`,

integrations/vite/html-style-blocks.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ test(
1212
},
1313
"devDependencies": {
1414
"@tailwindcss/vite": "workspace:^",
15-
"vite": "^6"
15+
"vite": "^7"
1616
}
1717
}
1818
`,

integrations/vite/ignored-packages.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const WORKSPACE = {
1111
"tailwindcss": "workspace:^"
1212
},
1313
"devDependencies": {
14-
"vite": "^6"
14+
"vite": "^7"
1515
}
1616
}
1717
`,

integrations/vite/index.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe.each(['postcss', 'lightningcss'])('%s', (transformer) => {
3434
},
3535
"devDependencies": {
3636
${transformer === 'lightningcss' ? `"lightningcss": "^1",` : ''}
37-
"vite": "^6"
37+
"vite": "^7"
3838
}
3939
}
4040
`,
@@ -111,7 +111,7 @@ describe.each(['postcss', 'lightningcss'])('%s', (transformer) => {
111111
},
112112
"devDependencies": {
113113
${transformer === 'lightningcss' ? `"lightningcss": "^1",` : ''}
114-
"vite": "^6"
114+
"vite": "^7"
115115
}
116116
}
117117
`,
@@ -312,7 +312,7 @@ describe.each(['postcss', 'lightningcss'])('%s', (transformer) => {
312312
},
313313
"devDependencies": {
314314
${transformer === 'lightningcss' ? `"lightningcss": "^1",` : ''}
315-
"vite": "^6"
315+
"vite": "^7"
316316
}
317317
}
318318
`,
@@ -491,7 +491,7 @@ describe.each(['postcss', 'lightningcss'])('%s', (transformer) => {
491491
},
492492
"devDependencies": {
493493
${transformer === 'lightningcss' ? `"lightningcss": "^1",` : ''}
494-
"vite": "^6"
494+
"vite": "^7"
495495
}
496496
}
497497
`,
@@ -577,7 +577,7 @@ describe.each(['postcss', 'lightningcss'])('%s', (transformer) => {
577577
},
578578
"devDependencies": {
579579
${transformer === 'lightningcss' ? `"lightningcss": "^1",` : ''}
580-
"vite": "^6"
580+
"vite": "^7"
581581
}
582582
}
583583
`,
@@ -679,7 +679,7 @@ describe.each(['postcss', 'lightningcss'])('%s', (transformer) => {
679679
},
680680
"devDependencies": {
681681
${transformer === 'lightningcss' ? `"lightningcss": "^1",` : ''}
682-
"vite": "^6"
682+
"vite": "^7"
683683
}
684684
}
685685
`,
@@ -744,7 +744,7 @@ test(
744744
"tailwindcss": "workspace:^"
745745
},
746746
"devDependencies": {
747-
"vite": "^6"
747+
"vite": "^7"
748748
}
749749
}
750750
`,
@@ -816,7 +816,7 @@ test(
816816
"tailwindcss": "workspace:^"
817817
},
818818
"devDependencies": {
819-
"vite": "^6"
819+
"vite": "^7"
820820
}
821821
}
822822
`,
@@ -879,7 +879,7 @@ test(
879879
"@tailwindcss/vite": "workspace:^",
880880
"tailwindcss": "workspace:^",
881881
"plotly.js": "^3",
882-
"vite": "^6"
882+
"vite": "^7"
883883
}
884884
}
885885
`,

integrations/vite/multi-root.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ test(
1212
"tailwindcss": "workspace:^"
1313
},
1414
"devDependencies": {
15-
"vite": "^6"
15+
"vite": "^7"
1616
}
1717
}
1818
`,
@@ -96,7 +96,7 @@ test(
9696
"tailwindcss": "workspace:^"
9797
},
9898
"devDependencies": {
99-
"vite": "^6"
99+
"vite": "^7"
100100
}
101101
}
102102
`,

integrations/vite/other-transforms.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function createSetup(transformer: 'postcss' | 'lightningcss') {
1414
},
1515
"devDependencies": {
1616
${transformer === 'lightningcss' ? `"lightningcss": "^1",` : ''}
17-
"vite": "^6"
17+
"vite": "^7"
1818
}
1919
}
2020
`,

integrations/vite/source-maps.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ test(
1313
},
1414
"devDependencies": {
1515
"lightningcss": "^1",
16-
"vite": "^6"
16+
"vite": "^7"
1717
}
1818
}
1919
`,

integrations/vite/ssr.test.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,50 @@ test(
119119
])
120120
},
121121
)
122+
123+
test(
124+
`Vite 7`,
125+
{
126+
fs: {
127+
'package.json': json`
128+
{
129+
"type": "module",
130+
"dependencies": {
131+
"@tailwindcss/vite": "workspace:^",
132+
"tailwindcss": "workspace:^"
133+
},
134+
"devDependencies": {
135+
"vite": "^7"
136+
}
137+
}
138+
`,
139+
'vite.config.ts': ts`
140+
import tailwindcss from '@tailwindcss/vite'
141+
import { defineConfig } from 'vite'
142+
143+
export default defineConfig({
144+
build: {
145+
cssMinify: false,
146+
ssrEmitAssets: true,
147+
},
148+
plugins: [tailwindcss()],
149+
})
150+
`,
151+
...WORKSPACE,
152+
},
153+
},
154+
async ({ fs, exec, expect }) => {
155+
await exec('pnpm vite build --ssr server.ts')
156+
157+
let files = await fs.glob('dist/**/*.css')
158+
expect(files).toHaveLength(1)
159+
let [filename] = files[0]
160+
161+
await fs.expectFileToContain(filename, [
162+
candidate`underline`,
163+
candidate`m-2`,
164+
candidate`overline`,
165+
candidate`m-3`,
166+
])
167+
},
168+
)

0 commit comments

Comments
 (0)