-
Notifications
You must be signed in to change notification settings - Fork 3.7k
/
Copy pathvite.config.ts
71 lines (68 loc) · 1.65 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import path from 'path'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import replace from '@rollup/plugin-replace'
import { isAppNVueNativeTag } from '@dcloudio/uni-shared'
function resolve(file: string) {
return path.resolve(__dirname, file)
}
export default defineConfig({
root: __dirname,
define: {
global: 'window',
__PLATFORM__: "'app'",
__NODE_JS__: false,
__APP_VIEW__: false,
__VUE_OPTIONS_API__: true,
__VUE_PROD_DEVTOOLS__: false,
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: false,
__UNI_FEATURE_WX__: true,
__UNI_FEATURE_PROMISE__: false,
__UNI_FEATURE_I18N_EN__: true,
__UNI_FEATURE_I18N_ES__: true,
__UNI_FEATURE_I18N_FR__: true,
__UNI_FEATURE_I18N_ZH_HANS__: true,
__UNI_FEATURE_I18N_ZH_HANT__: true,
__PLUS__: true,
},
resolve: {
alias: [
{
find: '@dcloudio/uni-core',
replacement: resolve('../uni-core/src'),
},
],
},
build: {
minify: false,
lib: {
name: 'components',
entry: path.resolve(__dirname, 'src/nvue/components.ts'),
formats: ['es'],
},
rollupOptions: {
external: ['uni', 'vue', 'weex', '@vue/shared', '@dcloudio/uni-shared'],
output: {
entryFileNames: 'components.js',
},
},
},
plugins: [
vue(),
vueJsx({
isCustomElement: (tag) => {
if (tag === 'slider') {
return true
}
return isAppNVueNativeTag(tag)
},
}),
replace({
preventAssignment: true,
values: {
__DEV__: `(process.env.NODE_ENV !== 'production')`,
},
}),
],
})