-
Notifications
You must be signed in to change notification settings - Fork 75
/
vite.base.config.ts
43 lines (40 loc) · 1.51 KB
/
vite.base.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
import { defineConfig } from 'vite';
import path from 'path';
import PrecompileEjs from './app/assets/javascripts/libs/precompile_ejs';
const aliasMap = {
vendor: path.join(__dirname, 'vendor/assets/javascripts'),
collections: path.join(__dirname, 'app/assets/javascripts/collections'),
mixins: path.join(__dirname, 'app/assets/javascripts/mixins'),
models: path.join(__dirname, 'app/assets/javascripts/models'),
templates: path.join(__dirname, 'app/assets/javascripts/templates'),
views: path.join(__dirname, 'app/assets/javascripts/views'),
libs: path.join(__dirname, 'app/assets/javascripts/libs'),
components: path.join(__dirname, 'app/assets/javascripts/components'),
controllers: path.join(__dirname, 'app/assets/javascripts/controllers'),
reducers: path.join(__dirname, 'app/assets/javascripts/reducers'),
actions: path.join(__dirname, 'app/assets/javascripts/actions'),
central: path.join(__dirname, 'app/assets/javascripts/central'),
store: path.join(__dirname, 'app/assets/javascripts/store'),
gritter: 'gritter/js/jquery.gritter.min.js',
};
const alias = Object.entries(aliasMap).map(([key, value]) => ({
find: key,
replacement: value,
}));
export default defineConfig({
plugins: [PrecompileEjs()],
esbuild: {
loader: 'jsx',
include: [
'app/**/*.jsx',
'spec/javascripts/**/*.jsx',
// Add these lines to allow all .js files to contain JSX
'app/**/*.js',
'spec/javascripts/**/*.js',
],
exclude: [],
},
resolve: {
alias: [...alias],
},
});