-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
39 lines (37 loc) · 1.09 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
import path from 'path'
import { defineConfig, UserConfigExport, ConfigEnv } from 'vite'
import dts from 'vite-plugin-dts'
import banner from 'vite-plugin-banner'
import pkg from './package.json'
// https://vitejs.dev/config/
const config = ({ command, mode }: ConfigEnv): UserConfigExport => {
return defineConfig({
build: {
target: 'es2015',
outDir: 'dist',
lib: {
entry: path.resolve(__dirname, './src/main.ts'),
name: 'PiniaPersistedstatePlugin',
fileName: `pinia-persistedstate-plugin`
},
rollupOptions: {
output: {
// 在 UMD 构建模式下为这些外部化的依赖提供一个全局变量
globals: {
PiniaPersistedstatePlugin: 'PiniaPersistedstatePlugin'
}
}
}
},
plugins: [
dts({
insertTypesEntry: true,
copyDtsFiles: false
}),
banner(
`/**\n * name: ${pkg.name}\n * version: v${pkg.version}\n * description: ${pkg.description}\n * author: ${pkg.author}\n * homepage: ${pkg.homepage}\n */`
)
]
})
}
export default config