-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.ts
More file actions
74 lines (73 loc) · 2.11 KB
/
vite.config.ts
File metadata and controls
74 lines (73 loc) · 2.11 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
* @Author: MrRice wangwei@jlkj.net
* @Date: 2024-05-13 17:05:08
* @LastEditors: 米大饭 1246333567@qq.com
* @LastEditTime: 2024-08-05 22:31:46
* @FilePath: /cesium-path/vite.config.ts
* @Description: 小舟从此逝,江海寄余生
*
* Copyright (c) 2024 by MrRice : wangwei@jlkj.net , All Rights Reserved.
*/
//@ts-nocheck
import { defineConfig } from 'vite';
import { resolve } from 'path';
import { directoryPlugin } from 'vite-plugin-list-directory-contents';
import sourcemapLoad from 'vite-plugin-sourcemap-load';
import dts from 'vite-plugin-dts';
import fs from 'fs';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [directoryPlugin({ baseDir: __dirname })],
optimizeDeps: {
// exclude: ['cesium'], // 将你需要查看源码的包名称加入到数组中
// include: ['autolinker']
// force:false,
// noDiscovery:true,
// disabled:true
},
server: {
host: '0.0.0.0',
cors: true,
// port: 5173,//端口号
proxy: {
//代理地址
'/xxx': {
target: 'http:xxxxxxxx/',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/xxx/, ''),
},
},
},
base: './',
resolve: {
//别名
alias: {
cesiumPath: '/src/main.ts',
pathGeometry: '/src/PathGeometry.js',
pathGeometry2: '/src/PathGeometry2.js',
pathPointList: '/src/PathPointList.js',
customPrimitive: '/src/CustomPrimitive.ts',
},
},
build: {
lib: {
entry: resolve(__dirname, 'src/main.ts'), //入口文件
name: 'CesiumPath',
fileName: 'CesiumPath', //
formats: ['umd', 'es', 'iife'], //打包的模式
},
rollupOptions: {
output: {
dir: './dist', //打包后输出的文件夹目录
// entryFileNames: 'hellolib.js',//生成的文件的名字(仅限于生成单文件)
banner: `
/**
* build time:${new Date().toLocaleString()}
*/
`, //你要在打包的文件里额外写入的内容
},
external: ['cesium', 'three', '@cesium'], //不打包的库
},
minify: false,
},
});