2021-08-24 01:58:40 +08:00
|
|
|
import path from 'path'
|
|
|
|
import { viteMockServe } from 'vite-plugin-mock'
|
|
|
|
import { defineConfig } from 'vite'
|
2021-07-16 13:00:21 +08:00
|
|
|
|
2021-08-24 01:58:40 +08:00
|
|
|
export default defineConfig(({ command }) => {
|
2021-07-16 13:00:21 +08:00
|
|
|
return {
|
2021-08-24 01:58:40 +08:00
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
'~/': `${path.resolve(__dirname, 'src')}/`
|
|
|
|
}
|
|
|
|
},
|
2021-07-16 13:00:21 +08:00
|
|
|
plugins: [
|
|
|
|
viteMockServe({
|
|
|
|
mockPath: 'mock',
|
2021-08-24 01:58:40 +08:00
|
|
|
localEnabled: command == 'serve'
|
2021-08-31 10:54:16 +08:00
|
|
|
})
|
2021-07-16 13:00:21 +08:00
|
|
|
],
|
|
|
|
esbuild: {
|
|
|
|
jsxFactory: 'h',
|
2021-08-07 11:04:43 +08:00
|
|
|
jsxFragment: 'h.f'
|
2021-08-24 01:58:40 +08:00
|
|
|
},
|
|
|
|
server: {
|
|
|
|
fs: {
|
|
|
|
strict: true
|
|
|
|
}
|
2021-07-16 13:00:21 +08:00
|
|
|
}
|
|
|
|
}
|
2021-08-24 01:58:40 +08:00
|
|
|
})
|