-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
vite.config.ts
52 lines (51 loc) · 1.96 KB
/
vite.config.ts
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
51
52
import { resolve } from 'path'
import type { UserConfigExport } from 'vite'
export default (): UserConfigExport => {
return {
server: {
port: 1024
},
build: {
target: 'modules',
minify: true,
emptyOutDir: false,
outDir: resolve(__dirname, './dist'),
lib: {
entry: resolve(__dirname, 'src/index.ts'),
name: 'FightingWeb' // 包名
},
rollupOptions: {
output: [
// {
// format: 'umd',
// exports: 'named',
// sourcemap: false,
// dir: 'dist/dist',
// entryFileNames: 'index.umd.js',
// chunkFileNames: '[name].js',
// assetFileNames: '[name].[ext]',
// namespaceToStringTag: true,
// inlineDynamicImports: false
// },
{
format: 'es', // 打包模式 https://rollupjs.org/guide/en/#outputformat
exports: 'named', // 导出模式 https://rollupjs.org/guide/en/#outputexports
dir: 'dist/', // 输出路径 https://rollupjs.org/guide/en/#outputdir
sourcemap: false, // https://rollupjs.org/guide/en/#outputsourcemap
entryFileNames: 'index.js', // 输出后的文件名 https://rollupjs.org/guide/en/#outputentryfilenames
chunkFileNames: '[name].js', // 输出的 chunk文件名 https://rollupjs.org/guide/en/#outputchunkfilenames
assetFileNames: '[name].[ext]', // 输出资产文件名 https://rollupjs.org/guide/en/#outputassetfilenames
namespaceToStringTag: true, // https://rollupjs.org/guide/en/#outputnamespacetostringtag
inlineDynamicImports: false, // https://rollupjs.org/guide/en/#outputinlinedynamicimports
preserveModules: true // https://rollupjs.org/guide/en/#outputpreservemodules
}
]
}
// rollupOptions: {
// output: {
// preserveModules: true
// }
// }
}
} as UserConfigExport
}