-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
45 lines (42 loc) · 1.16 KB
/
vite.config.ts
File metadata and controls
45 lines (42 loc) · 1.16 KB
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
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from "path"
import dts from 'vite-plugin-dts'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue({
reactivityTransform: true
}),
dts({
//指定使用的tsconfig.json为我们整个项目根目录下掉,如果不配置,你也可以在components下新建tsconfig.json
tsConfigFilePath: './tsconfig.json'
}),
//因为这个插件默认打包到es下,我们想让lib目录下也生成声明文件需要再配置一个
dts({
outputDir: 'lib',
tsConfigFilePath: './tsconfig.json'
})],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
build: {
outDir: "dist/ol-map-vue3", //输出文件名称
lib: {
entry: path.resolve(__dirname, "./src/components/ol-map-ui/index.ts"), //指定组件编译入口文件
name: 'ol-map-vue3',
fileName: 'ol-map-vue3',
},
rollupOptions: {
external: ["vue"],
output: {
globals: {
vue: "Vue",
}
}
}
}
})