forked from vitejs/vite
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.js
42 lines (41 loc) · 825 Bytes
/
vite.config.js
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
const fs = require('fs')
const path = require('path')
/**
* @type {import('vite').UserConfig}
*/
module.exports = {
esbuild: {
supported: {
// Force esbuild inject helpers to test regex
'object-rest-spread': false
}
},
build: {
rollupOptions: {
output: {
banner: `/*!\nMayLib\n*/`
}
},
lib: {
entry: path.resolve(__dirname, 'src/main.js'),
name: 'MyLib',
formats: ['es', 'umd', 'iife'],
fileName: 'my-lib-custom-filename'
}
},
plugins: [
{
name: 'emit-index',
generateBundle() {
this.emitFile({
type: 'asset',
fileName: 'index.html',
source: fs.readFileSync(
path.resolve(__dirname, 'index.dist.html'),
'utf-8'
)
})
}
}
]
}