Skip to content

Commit 9ba0667

Browse files
committedMar 21, 2024
Add autoprefixer
Vite already has esbuild which has a built-in prefixer (based on the --target option). However, it seems to only apply on build (when CSS minification is enabled) and I can’t seem to find a way to run the CSS through esbuild on the dev server. If this can be figured out, it should be preferred to avoid the extra dependency.
1 parent 0dcb578 commit 9ba0667

File tree

4 files changed

+160
-1
lines changed

4 files changed

+160
-1
lines changed
 

‎package-lock.json

+151
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"dependencies": {
1818
"@sveltejs/vite-plugin-svelte": "3.0.2",
1919
"@tsconfig/svelte": "5.0.2",
20+
"autoprefixer": "10.4.19",
2021
"date-fns": "3.6.0",
2122
"firebase": "10.9.0",
2223
"svelte": "4.2.12",

‎tsconfig.node.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"compilerOptions": {
33
"composite": true,
44
"module": "ESNext",
5-
"moduleResolution": "Node"
5+
"moduleResolution": "Node",
6+
"allowSyntheticDefaultImports": true
67
},
78
"include": ["vite.config.ts"]
89
}

‎vite.config.ts

+6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { svelte, vitePreprocess } from '@sveltejs/vite-plugin-svelte';
2+
import autoprefixer from 'autoprefixer';
23
import type { PluginVisualizerOptions } from 'rollup-plugin-visualizer';
34
import { defineConfig } from 'vite';
45

@@ -15,6 +16,11 @@ export default defineConfig(({ command, mode }) => {
1516
template: 'sunburst',
1617
}),
1718
],
19+
css: {
20+
postcss: {
21+
plugins: [autoprefixer()],
22+
},
23+
},
1824
server: {
1925
port: 3000,
2026
},

0 commit comments

Comments
 (0)
Please sign in to comment.