-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
64 lines (63 loc) · 1.41 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import path from 'path'
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'
import { rawMdx } from './plugins/vite-plugin-raw.mdx'
import { viteStaticCopy } from 'vite-plugin-static-copy'
import vitePluginCssInjectedByJs from 'vite-plugin-css-injected-by-js'
// https://vitejs.dev/config/
export default defineConfig({
base: './',
plugins: [
react(),
rawMdx(),
viteStaticCopy({
targets: [
{
src: 'src/assets/icons/**/*',
dest: 'assets/icons'
},
{
src: 'src/assets/sounds/**/*',
dest: 'assets/sounds'
}
]
}),
vitePluginCssInjectedByJs()
],
resolve: {
alias: {
'@': path.resolve(__dirname, './src')
}
},
publicDir: false,
server: {
open: '/example/index.html',
fs: {
strict: false
}
},
build: {
lib: {
entry: path.resolve(__dirname, 'src/index.ts'),
name: 'ReactPrettyCode',
fileName: (format) => `react-pretty-code.${format}.js`,
formats: ['es', 'umd']
},
rollupOptions: {
external: ['react', 'react-dom'],
input: {
main: path.resolve(__dirname, 'src/index.ts')
},
output: {
globals: {
react: 'React',
'react-dom': 'ReactDOM'
},
exports: 'named'
}
},
cssCodeSplit: true,
emptyOutDir: false,
assetsInlineLimit: 100 * 1024
}
})