-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
39 lines (37 loc) · 1.07 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
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import * as path from 'path';
import FullReload from 'vite-plugin-full-reload';
import RubyPlugin from 'vite-plugin-ruby';
import dotenv from 'dotenv';
dotenv.config();
const removeSlashes = (str) => str.split('/')[1];
export default defineConfig({
base: './',
plugins: [vue(), RubyPlugin(), FullReload(['config/routes.rb', 'app/views/**/*'], { delay: 250 })],
resolve: {
alias: [
{
find: '@/lib',
replacement: path.resolve(__dirname, './app/frontend/components/lib/')
},
{
find: '@/components',
replacement: path.resolve(__dirname, './app/frontend/components/')
},
{
find: '@/resources',
replacement: path.resolve(__dirname, './app/frontend/resources/')
},
{
find: '@/entrypoints',
replacement: path.resolve(__dirname, './app/frontend/entrypoints')
}
]
},
define: {
'process.env': {
RAILS_RELATIVE_URL_ROOT: removeSlashes(process.env.RAILS_RELATIVE_URL_ROOT || '')
}
}
});