This repository has been archived by the owner on Jun 10, 2024. It is now read-only.
generated from bcakmakoglu/temple-of-time
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
82 lines (76 loc) · 2.21 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
import React from '@vitejs/plugin-react-refresh'
import { resolve } from 'path'
import { pascalCase } from 'scule'
import AutoImport from 'unplugin-auto-import/vite'
import { defineConfig } from 'vite'
import WindiCSS from 'vite-plugin-windicss'
import reactJsx from 'vite-react-jsx'
import AutoImportResolver from './resolver/auto-import-resolver'
// https://vitejs.dev/config/
export default defineConfig({
resolve: {
alias: {
'~/': `${resolve(__dirname, 'src')}/`,
'@/': `${resolve(__dirname)}/`,
},
},
base: './',
plugins: [
React(),
reactJsx(),
WindiCSS(),
AutoImport({
// output dir + name of the d.ts file
dts: './src/auto-imports.d.ts',
// targets to transform
include: [
/\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
],
resolvers: [
// Components auto import resolver
AutoImportResolver({
path: resolve(__dirname, 'src/components'),
resolve: (_, slice) => ({
module: `~/components/${pascalCase(slice)}`,
name: pascalCase(slice),
from: 'default',
}),
}),
// React Use auto import resolver
AutoImportResolver({
path: resolve(__dirname, 'node_modules/react-use/lib'),
resolve: (name) => {
return {
module: 'react-use',
name,
}
},
}),
// Forma components auto import resolver
AutoImportResolver({
path: resolve(__dirname, 'node_modules/@contentful/forma-36-react-components/dist/components'),
prefix: 'forma', // i.e. you use the components as <FormaComponent />, feel free to use your preferred prefix
resolve: (name, slice) => ({
module: '@contentful/forma-36-react-components',
name,
from: pascalCase(slice),
}),
}),
],
imports: [
'react',
{
scule: ['pascalCase', 'camelCase', 'kebabCase', 'snakeCase', 'upperFirst', 'lowerFirst', 'splitByCase'],
},
],
}),
],
server: {
fs: {
strict: true,
},
},
optimizeDeps: {
include: ['react', 'react-dom', 'react-use', '@contentful/app-sdk'],
},
})