forked from alchemix-finance/alchemix-v2-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
41 lines (39 loc) · 1.32 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
import { defineConfig } from 'vite';
import { svelte } from '@sveltejs/vite-plugin-svelte';
import nodePolyfills from 'rollup-plugin-polyfill-node';
import { fileURLToPath } from 'url';
const MODE = process.env.NODE_ENV;
const development = MODE === 'development';
export default defineConfig({
plugins: [
development &&
nodePolyfills({
include: ['node_modules/**/*.js', new RegExp('node_modules/.vite/.*js')],
}),
svelte(),
],
resolve: {
alias: {
crypto: 'crypto-browserify',
stream: 'stream-browserify',
assert: 'assert',
'@': fileURLToPath(new URL('./src', import.meta.url)),
'@stores': fileURLToPath(new URL('./src/stores', import.meta.url)),
'@components': fileURLToPath(new URL('./src/components', import.meta.url)),
'@helpers': fileURLToPath(new URL('./src/helpers', import.meta.url)),
'@locales': fileURLToPath(new URL('./src/locales', import.meta.url)),
'@middleware': fileURLToPath(new URL('./src/middleware', import.meta.url)),
'@views': fileURLToPath(new URL('./src/views', import.meta.url)),
'@styles': fileURLToPath(new URL('./src/styles', import.meta.url)),
},
},
build: {
rollupOptions: {
plugins: [nodePolyfills()],
},
commonjsOptions: {
transformMixedEsModules: true,
},
},
base: '',
});