-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
69 lines (67 loc) · 1.83 KB
/
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
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
import path from 'path';
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import Unocss from 'unocss/vite';
import presetUno from '@unocss/preset-uno';
import presetIcons from '@unocss/preset-icons';
import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js';
import svgLoader from './src/plugins/svg-loader';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
svgLoader({
defaultImport: 'url', // or 'raw'
svgo: false,
}),
Unocss({
presets: [
presetUno(),
presetIcons({
extraProperties: {
display: 'inline-block',
'vertical-align': 'middle',
},
}),
],
}),
cssInjectedByJsPlugin({
// topExecutionPriority: false,
}),
],
build: {
lib: {
entry: path.resolve(__dirname, 'build-config/build-lib.js'),
name: 'DIDConnect',
// formats: ['cjs', 'es', 'iife'],
fileName: (format) => `did-connect.${format}.js`,
},
rollupOptions: {
// 确保外部化处理那些你不想打包进库的依赖
external: [
'vue',
'@fontsource/ubuntu-mono/400.css',
// 'axios',
// 'buffer',
// 'tweetnacl',
// 'naive-ui',
// '@arcblock/did-motif',
// '@arcblock/event-client',
// 'tweetnacl-sealedbox-js',
],
output: {
// 在 UMD 构建模式下为这些外部化的依赖提供一个全局变量
globals: {
vue: 'Vue',
// axios: 'Axios',
// buffer: 'Buffer',
// 'naive-ui': 'NaiveUI',
// tweetnacl: 'TweetNacl',
// '@arcblock/did-motif': 'DidMotif',
// '@arcblock/event-client': 'EventClient',
// 'tweetnacl-sealedbox-js': 'TweetNaclSealedBox',
},
},
},
},
});