This repository has been archived by the owner on Jul 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
vite.config.ts
156 lines (138 loc) · 3.85 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
import './etc/git-rev-into-env'
import path from 'path'
import { defineConfig } from 'vitest/config'
import Vue from '@vitejs/plugin-vue'
import Components from 'unplugin-vue-components/vite'
import AutoImport from 'unplugin-auto-import/vite'
import VueI18n from '@intlify/vite-plugin-vue-i18n'
import Inspect from 'vite-plugin-inspect'
import SvgLoader from '@soramitsu-ui/vite-plugin-svg'
import VueSetupExtend from 'vite-plugin-vue-setup-extend'
import UnoCSS from 'unocss/vite'
import Icons from 'unplugin-icons/vite'
import { FileSystemIconLoader } from 'unplugin-icons/loaders'
import KlaytnIcons from './etc/vite-plugin-klaytn-icons'
import AppAbi from './etc/vite-plugin-abi'
import AppConfig from './etc/vite-plugin-config'
export default defineConfig({
resolve: {
alias: {
'@/': `${path.resolve(__dirname, 'src')}/`,
web3: 'web3/dist/web3.min.js',
'@popperjs/core': '@popperjs/core/lib/index',
'@soramitsu-ui/ui': process.env.NODE_ENV === 'test' ? '@soramitsu-ui/ui/dist/lib.cjs' : '@soramitsu-ui/ui',
'@uniswap/v2-sdk': '@uniswap/v2-sdk/dist/v2-sdk.esm.js',
'@uniswap/sdk-core': '@uniswap/sdk-core/dist/sdk-core.esm.js',
},
},
define: {
'import.meta.vitest': 'undefined',
},
plugins: [
Vue({
include: [/\.vue$/, /\.md$/],
reactivityTransform: true,
}),
VueSetupExtend(),
UnoCSS({
theme: {
breakpoints: {
sm: '452px',
md: '960px',
lg: '1280px',
},
},
rules: [[/^flex-(\d)$/, ([, d]: any) => ({ flex: `${d} ${d} 0%` })]],
}),
SvgLoader(),
Icons({
customCollections: {
klay: FileSystemIconLoader('./src/assets/icons'),
},
}),
KlaytnIcons(),
AppAbi(),
AppConfig(),
// https://github.com/antfu/unplugin-auto-import
AutoImport({
imports: [
'vue',
'vue-router',
'vue-i18n',
'vue/macros',
'@vueuse/head',
'@vueuse/core',
'@vueuse/math',
{
'@vueuse/router': ['useRouteParams'],
},
{
'@vue-kakuyaku/core': [
'useParamScope',
'useDeferredScope',
'useErrorRetry',
'usePromise',
'wheneverDone',
'wheneverFulfilled',
'wheneverRejected',
'useStaleState',
'flattenState',
'useTask',
],
},
],
dts: 'src/auto-imports.d.ts',
dirs: [
'src/composables',
'src/store',
'src/modules/ModuleFarming/store',
'src/modules/ModuleStaking/store',
'src/modules/ModuleGovernance/store',
'src/modules/ModuleSwap/store',
'src/modules/ModuleLiquidity/store',
'src/modules/ModuleAssets/store',
],
vueTemplate: true,
eslintrc: {
enabled: true,
},
}),
// https://github.com/antfu/unplugin-vue-components
Components({
dirs: ['src/components/common', 'src/modules'],
include: [/\.vue$/, /\.vue\?vue/],
dts: 'src/components.d.ts',
directoryAsNamespace: true,
}),
// https://github.com/intlify/bundle-tools/tree/main/packages/vite-plugin-vue-i18n
VueI18n({
runtimeOnly: true,
compositionOnly: true,
include: [path.resolve(__dirname, 'locales/**')],
}),
// https://github.com/antfu/vite-plugin-inspect
// Visit http://localhost:3333/__inspect/ to see the inspector
Inspect(),
],
// https://github.com/vitest-dev/vitest
test: {
include: ['src/**/*.spec.ts'],
includeSource: ['src/**/*.ts'],
environment: 'jsdom',
deps: {
inline: ['@vue', '@vueuse', 'vue-demi'],
},
},
css: {
modules: {
localsConvention: 'camelCaseOnly',
},
},
build: {
target: 'esnext',
/**
* To avoid conflicts with the route "/assets"
*/
assetsDir: '__assets',
},
})