Repository navigation
Expand file tree
/
Copy pathvite.config.ts
More file actions
136 lines (129 loc) · 3.9 KB
/
Copy pathvite.config.ts
File metadata and controls
136 lines (129 loc) · 3.9 KB
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
import {defineConfig} from 'vitest/config';
import solidPlugin from 'vite-plugin-solid';
import handlebars from 'vite-plugin-handlebars';
import basicSsl from '@vitejs/plugin-basic-ssl';
import {visualizer} from 'rollup-plugin-visualizer';
import checker from 'vite-plugin-checker';
// import devtools from 'solid-devtools/vite'
import autoprefixer from 'autoprefixer';
import {resolve} from 'path';
import {existsSync} from 'fs';
import {ServerOptions} from 'vite';
const rootDir = resolve(__dirname);
const handlebarsPlugin = handlebars({
context: {
title: 'Telegram Web',
description: 'Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.',
url: 'https://web.teamgram.net/k/',
origin: 'https://web.teamgram.net/'
}
});
const serverOptions: ServerOptions = {
// host: '192.168.95.17',
port: 8080,
sourcemapIgnoreList(sourcePath, sourcemapPath) {
return sourcePath.includes('node_modules') || sourcePath.includes('logger');
}
};
const USE_SSL = false;
const NO_MINIFY = false;
const HAS_SOLID = existsSync(resolve(rootDir, 'src/vendor/solid'));
const SSL_CONFIG: any = undefined && USE_SSL && {
name: '192.168.95.17',
certDir: './certs/'
};
const ADDITIONAL_ALIASES = {
'solid-transition-group': resolve(rootDir, 'src/vendor/solid-transition-group')
};
console.log('has built solid', HAS_SOLID);
export default defineConfig({
plugins: [
// devtools({
// /* features options - all disabled by default */
// autoname: true // e.g. enable autoname
// }),
process.env.VITEST ? undefined : checker({
typescript: true,
eslint: {
// for example, lint .ts and .tsx
lintCommand: 'eslint "./src/**/*.{ts,tsx}" --ignore-pattern "/src/solid/*"'
}
}),
solidPlugin(),
handlebarsPlugin as any,
USE_SSL ? (basicSsl as any)(SSL_CONFIG) : undefined,
visualizer({
gzipSize: true,
template: 'treemap'
})
].filter(Boolean),
test: {
// include: ['**/*.{test,spec}.?(c|m)[jt]s?(x)'],
exclude: [
'**/node_modules/**',
'**/dist/**',
'**/cypress/**',
'**/.{idea,git,cache,output,temp}/**',
'**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*',
'**/solid/**'
],
// coverage: {
// provider: 'v8',
// reporter: ['text', 'lcov'],
// include: ['src/**/*.ts', 'store/src/**/*.ts', 'web/src/**/*.ts'],
// exclude: ['**/*.d.ts', 'src/server/*.ts', 'store/src/**/server.ts']
// },
environment: 'jsdom',
testTransformMode: {web: ['.[jt]sx?$']},
// otherwise, solid would be loaded twice:
// deps: {registerNodeLoader: true},
// if you have few tests, try commenting one
// or both out to improve performance:
threads: false,
isolate: false,
globals: true,
setupFiles: ['./src/tests/setup.ts']
},
server: serverOptions,
base: '',
build: {
target: 'es2020',
sourcemap: true,
assetsDir: '',
copyPublicDir: false,
emptyOutDir: true,
minify: NO_MINIFY ? false : undefined,
rollupOptions: {
output: {
sourcemapIgnoreList: serverOptions.sourcemapIgnoreList
}
// input: {
// main: './index.html',
// sw: './src/index.service.ts'
// }
}
// cssCodeSplit: true
},
worker: {
format: 'es'
},
css: {
devSourcemap: true,
postcss: {
plugins: [
autoprefixer({}) // add options if needed
]
}
},
resolve: {
// conditions: ['development', 'browser'],
alias: HAS_SOLID ? {
'rxcore': resolve(rootDir, 'src/vendor/solid/web/core'),
'solid-js/jsx-runtime': resolve(rootDir, 'src/vendor/solid/jsx'),
'solid-js/web': resolve(rootDir, 'src/vendor/solid/web'),
'solid-js/store': resolve(rootDir, 'src/vendor/solid/store'),
'solid-js': resolve(rootDir, 'src/vendor/solid'),
...ADDITIONAL_ALIASES
} : ADDITIONAL_ALIASES
}
});