-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
28 lines (27 loc) · 1.07 KB
/
vite.config.ts
File metadata and controls
28 lines (27 loc) · 1.07 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
import {defineConfig} from 'vite';
import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js';
import dts from 'vite-plugin-dts';
export default defineConfig({
build: {
lib: {
entry: 'src/index.ts', // Your main entry file
name: 'Flash', // Global variable name (if used in browser)
fileName: (format) => format === 'umd' ? 'index.umd.js' : 'index.js',
formats: ['es', 'umd'], // ES Modules + UMD for wider compatibility
},
rollupOptions: {
external: [], // Mark external dependencies (like React, if any)
output: {
assetFileNames: 'assets/[name][extname]', // Preserve CSS file name
globals: {}, // Define global variables for UMD build
},
},
sourcemap: true,
cssCodeSplit: false, // Force CSS into JS
},
plugins: [
cssInjectedByJsPlugin(), // Injects CSS automatically
dts(), // Generates .d.ts files
],
assetsInclude: ['**/*.svg'], // This tells Vite to treat SVGs as assets
});