forked from Ilhasoft/floweditor
-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.js
95 lines (93 loc) · 2.12 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
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
import { coverageConfigDefaults, defineConfig } from 'vitest/config';
import path from 'path';
import tsconfigPaths from 'vite-tsconfig-paths';
import { viteCommonjs } from '@originjs/vite-plugin-commonjs';
import veauryVitePlugins from 'veaury/vite/index.js';
import eslint from 'vite-plugin-eslint';
export default defineConfig({
plugins: [
eslint({ cache: false }),
tsconfigPaths({ loose: true }),
viteCommonjs(),
veauryVitePlugins({
type: 'react',
}),
],
resolve: {
alias: {
src: path.resolve(__dirname, './src'),
},
},
server: {
proxy: {
'/.netlify/functions/': {
target: 'http://localhost:6000/',
changeOrigin: true,
},
},
},
css: {
preprocessorOptions: {
scss: {
additionalData: `
@import '@weni/unnnic-system/src/assets/scss/unnnic.scss';
`,
},
},
},
test: {
cache: true,
clearMocks: true,
globals: true,
setupFiles: ['./vitest-setup.ts', 'vitest.d.ts'],
environment: 'jsdom',
root: 'src',
pool: 'threads',
coverage: {
enabled: true,
provider: 'istanbul',
reporter: ['lcov', 'text', 'html'],
reportsDirectory: './coverage',
exclude: [
'__mocks__/**',
'utils/**',
'testUtils/**',
'services/__mocks__/**',
'assets/**',
'static/**',
'test/**',
...coverageConfigDefaults.exclude,
],
},
},
build: {
outDir: 'build',
sourcemap: true,
manifest: true,
rollupOptions: {
input: ['./src/main.jsx'],
output: {
format: 'iife',
assetFileNames: assetInfo => {
const extType = assetInfo.name.split('.').at(1);
console.log('extType', extType);
if (/ttf|woff/i.test(extType)) {
return 'sitestatic/assets/[name]-[hash][extname]';
}
return 'assets/[name]-[hash][extname]';
},
},
},
commonjsOptions: {
transformMixedEsModules: true,
},
},
optimizeDeps: {
force: true,
esbuildOptions: {
loader: {
'.js': 'jsx',
},
},
},
});