-
Notifications
You must be signed in to change notification settings - Fork 2
/
vite.config.ts
49 lines (48 loc) · 1.38 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
40
41
42
43
44
45
46
47
48
49
import { defineConfig } from 'vite';
import reactRefresh from '@vitejs/plugin-react-refresh';
import tsconfigPaths from 'vite-tsconfig-paths';
import { viteSingleFile } from 'vite-plugin-singlefile';
import copy from 'rollup-plugin-copy';
// https://vitejs.dev/config/
export default defineConfig({
base: '/violet/',
plugins: [
reactRefresh(),
tsconfigPaths(),
// JS 代码打包成单个文件,避免引入模块依赖
// ref: https://github.com/richardtallent/vite-plugin-singlefile#how-do-i-use-it
viteSingleFile(),
// ref: https://github.com/vitejs/vite/issues/1231#issuecomment-753549857
copy({
targets: [{ src: './manifest.json', dest: 'dist' }],
hook: 'writeBundle',
}),
],
esbuild: {
jsxInject: "import * as React from 'react'",
},
css: {
modules: {
localsConvention: 'camelCaseOnly',
},
},
build: {
target: 'es6',
assetsInlineLimit: 100000000,
chunkSizeWarningLimit: 100000000,
cssCodeSplit: false,
brotliSize: false,
emptyOutDir: false,
rollupOptions: {
inlineDynamicImports: true,
output: {
manualChunks: () => 'everything.js',
// without hash
// ref: https://github.com/vitejs/vite/issues/378#issuecomment-768816653
entryFileNames: `[name].js`,
chunkFileNames: `[name].js`,
assetFileNames: `[name].[ext]`,
},
},
},
});