-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathvite.config.demo.js
More file actions
49 lines (44 loc) · 1.35 KB
/
Copy pathvite.config.demo.js
File metadata and controls
49 lines (44 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import { cloudflare } from '@cloudflare/vite-plugin';
import tailwindcss from '@tailwindcss/vite';
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';
import svgr from 'vite-plugin-svgr';
import { resolve } from 'path';
import { fileURLToPath } from 'url';
const __dirname = fileURLToPath(new URL('.', import.meta.url));
export default defineConfig({
// Set the root to the demo folder so Vite treats it as a standalone app
root: resolve(__dirname, 'src/demo'),
plugins: [
cloudflare({ configPath: resolve(__dirname, 'wrangler.jsonc') }),
svgr({
svgrOptions: {
// 1. Keeps the viewBox so the SVG can scale
icon: true,
// 2. Ensures 'className' and other props are passed to the <svg> tag
expandProps: 'end',
// 3. Prevents SVGO from stripping essential attributes
svgoConfig: {
plugins: [
{
name: 'preset-default',
params: {
overrides: {
removeViewBox: false, // Critical for scaling
},
},
},
],
},
},
include: '**/*.svg?react',
}),
react(),
tailwindcss(),
],
build: {
// Output one level up to the project root's dist-demo folder
outDir: resolve(__dirname, 'dist-demo'),
emptyOutDir: true,
},
});