-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathvite.config.js
More file actions
53 lines (52 loc) · 1.37 KB
/
vite.config.js
File metadata and controls
53 lines (52 loc) · 1.37 KB
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
import { defineConfig, transformWithEsbuild } from 'vite';
import react from '@vitejs/plugin-react';
import path from 'path';
export default defineConfig({
plugins: [
{
name: 'treat-js-files-as-jsx',
enforce: 'pre',
async transform(code, id) {
const normalizedId = id.replace(/\\/g, '/');
if (!normalizedId.includes('/src/') || !normalizedId.endsWith('.js')) {
return null;
}
return transformWithEsbuild(code, id, {
loader: 'jsx',
jsx: 'automatic',
});
},
},
react({
jsxRuntime: 'classic',
babel: {
babelrc: false,
configFile: false,
},
}),
],
optimizeDeps: {
esbuildOptions: {
loader: {
'.js': 'jsx',
},
},
},
resolve: {
alias: {
assets: path.resolve(__dirname, 'src/assets'),
components: path.resolve(__dirname, 'src/components'),
docs: path.resolve(__dirname, 'src/docs'),
entities: path.resolve(__dirname, 'src/entities'),
hooks: path.resolve(__dirname, 'src/hooks'),
layout: path.resolve(__dirname, 'src/layout'),
model: path.resolve(__dirname, 'src/model'),
screens: path.resolve(__dirname, 'src/screens'),
store: path.resolve(__dirname, 'src/store.js'),
utils: path.resolve(__dirname, 'src/utils'),
},
},
server: {
port: 3000,
},
});