-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathvite.config.ts
54 lines (53 loc) · 1.61 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
import path from 'path';
import { defineConfig, loadEnv } from 'vite';
import htmlPlugin from 'vite-plugin-html-config';
import svgr from '@svgr/rollup';
import react from '@vitejs/plugin-react';
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '');
return {
build: {
rollupOptions: {
output: {
assetFileNames: 'assets/[name].[hash].[ext]',
chunkFileNames: 'assets/[name].[hash].js',
entryFileNames: 'assets/[name].[hash].js',
manualChunks: {
'deriv-com': ['@deriv-com/api-hooks', '@deriv-com/utils'],
react: ['react', 'react-dom'],
},
},
},
},
css: {
preprocessorOptions: {
scss: {
additionalData: `@import "./styles/devices.scss"; @import "./styles/modals.scss";`, // Import mixins globally
},
},
},
define: {
'process.env': env,
},
envPrefix: 'VITE_',
plugins: [
react(),
svgr(),
htmlPlugin({
metas: [
{
content: process.env.VITE_APP_VERSION || '',
name: 'version',
},
],
}),
],
publicDir: 'public',
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
};
});