-
Notifications
You must be signed in to change notification settings - Fork 4
/
vite.config.ts
55 lines (53 loc) · 1.32 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
import { defineConfig, loadEnv } from 'vite';
import react from '@vitejs/plugin-react';
import tsconfigPaths from 'vite-tsconfig-paths';
import { nodePolyfills } from 'vite-plugin-node-polyfills';
import svgr from 'vite-plugin-svgr';
import { htmlInjectionPlugin } from 'vite-plugin-html-injection';
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), 'VITE');
return {
plugins: [
nodePolyfills({
// Enable protocol imports like `stream`, `http`, `https`, etc.
protocolImports: true,
}),
tsconfigPaths(),
react(),
svgr(),
htmlInjectionPlugin({
injections: [
{
name: 'Matomo Tag Manager',
path: './src/matomo/matomo_inject.html',
type: 'raw',
injectTo: 'head',
},
{
name: 'Matomo Event Tracking',
path: './src/matomo/matomo_events.html',
type: 'raw',
injectTo: 'head',
},
],
}),
],
resolve: {
alias: {
buffer: 'buffer',
process: 'process/browser',
},
},
optimizeDeps: {
esbuildOptions: {
define: {
global: 'globalThis',
},
},
},
build: {
rollupOptions: {},
},
};
});