-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
36 lines (32 loc) · 965 Bytes
/
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
import { defineConfig} from 'vite'
import { svelte } from '@sveltejs/vite-plugin-svelte'
import replace from '@rollup/plugin-replace';
import * as path from 'path';
import { config } from 'dotenv';
const configToReplace = {};
for (const [key, value] of Object.entries(config().parsed)) {
configToReplace[`process.env.${key}`] = JSON.stringify(value);
}
// https://vitejs.dev/config/
export default defineConfig({
plugins: [svelte(),
replace(
{
include: ['./src/**/*.svelte', './src/**/*.js', './src/**/*.ts'],
preventAssignment: true,
values: configToReplace
}
)],
resolve: {
alias: {
$lib: path.resolve('src/lib'),
$dialog: path.resolve('src/lib/dialog'),
$shared: path.resolve('src/lib/shared'),
$model: path.resolve('src/models'),
$view: path.resolve('src/views'),
$type: path.resolve('src/types'),
$api: path.resolve('src/api'),
$src: path.resolve('src'),
}
}
})