-
Notifications
You must be signed in to change notification settings - Fork 2
/
vite.config.ts
71 lines (69 loc) · 2.02 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
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import vue from '@vitejs/plugin-vue';
import * as path from 'path';
import { dynamicImport } from 'vite-plugin-dynamic-import';
import envCompatible from 'vite-plugin-env-compatible';
import eslintPlugin from 'vite-plugin-eslint';
import { defineConfig } from 'vitest/config';
import gitVersion from './build/git-version';
import * as pkg from './package.json';
// https://vitejs.dev/config/
// eslint-disable-next-line max-lines-per-function
export default () => {
// Do Node stuff here:
process.env.VITE_GIT_VERSION = gitVersion();
process.env.VITE_VERSION = pkg.version;
return defineConfig({
build: {
chunkSizeWarningLimit: 1000,
sourcemap: true,
rollupOptions: {
output: {
entryFileNames: `assets/[name].js`,
chunkFileNames: `assets/[name].js`,
assetFileNames: `assets/[name].[ext]`,
},
},
},
plugins: [vue(), nodeResolve(), dynamicImport(), envCompatible(), eslintPlugin({ fix: true })],
resolve: {
alias: {
'@starport/vuex': path.resolve(__dirname, './src/utils/EmerisError.ts'),
'@': path.resolve(__dirname, './src'),
},
extensions: ['.ts', '.vue', '.js', '.json', '.tsx'],
},
define: {
'process.env': process.env,
...(process.env.NODE_ENV !== 'test' && { 'process.platform': {} }),
},
server: {
port: 8080,
},
optimizeDeps: {
esbuildOptions: {
define: {
global: 'globalThis',
},
plugins: [
NodeGlobalsPolyfillPlugin({
buffer: true,
}),
],
},
},
test: {
globals: true,
environment: 'jsdom',
setupFiles: './tests/setup',
deps: {
inline: ['@vespaiach/axios-fetch-adapter'],
},
transformMode: {
web: [/\.[jt]sx$/],
},
exclude: ['**/node_modules/**', '**/dist/**', '**/e2e/**'],
},
});
};