-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvite.config.js
More file actions
36 lines (33 loc) · 819 Bytes
/
vite.config.js
File metadata and controls
36 lines (33 loc) · 819 Bytes
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
import { defineConfig } from 'vite';
import { readFileSync } from 'fs';
const pkg = JSON.parse(readFileSync('./package.json', 'utf-8'));
export default defineConfig(({ command }) => {
if (command === 'serve') {
// Dev mode: npm start
return {
server: {
port: 8080
}
};
}
// Standalone build: npm run standalone
// Bundles everything (including virtual-dom) into a single IIFE file
return {
build: {
lib: {
entry: './src/project/standalone.js',
name: 'CompostStandalone',
formats: ['iife'],
fileName: () => `compost-${pkg.version}.js`
},
outDir: 'docs/releases',
emptyOutDir: false,
minify: false,
rollupOptions: {
output: {
inlineDynamicImports: true
}
}
}
};
});