-
Notifications
You must be signed in to change notification settings - Fork 197
/
vite.config.lib.mjs
50 lines (47 loc) · 1000 Bytes
/
vite.config.lib.mjs
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
50
import { defineConfig } from 'vite'
import banner from 'vite-plugin-banner'
import { resolve } from 'node:path'
import pkg from './package.json'
const bannerTemplate = `
/**
${pkg.name} - ${pkg.homepage}
Version: ${pkg.version}
Author: ${pkg.author}
*/
`
export default defineConfig({
root: './',
build: {
lib: {
entry: resolve(__dirname, 'src/lib/js/index.js'),
name: 'formeo',
fileName: format => `[name].${format}.js`,
formats: ['es', 'cjs', 'umd'],
},
outDir: 'dist',
emptyOutDir: true,
minify: 'terser',
terserOptions: {
compress: {
drop_console: true,
drop_debugger: true,
},
},
rollupOptions: {
input: {
formeo: resolve(__dirname, 'src/lib/js/index.js'),
},
output: {
assetFileNames: 'formeo.min.[ext]',
},
},
},
plugins: [banner(bannerTemplate)],
css: {
preprocessorOptions: {
scss: {
api: 'modern-compiler',
},
},
},
})