-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
102 lines (99 loc) · 3.09 KB
/
vite.config.js
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// vite.config.js
import { resolve } from 'path';
import { defineConfig } from 'vite';
import { vitePlugin as remix, cloudflareDevProxyVitePlugin as remixCloudflareDevProxy } from '@remix-run/dev';
import jsconfigPaths from 'vite-jsconfig-paths';
import mdx from '@mdx-js/rollup';
import remarkFrontmatter from 'remark-frontmatter';
import remarkMdxFrontmatter from 'remark-mdx-frontmatter';
import rehypeImgSize from 'rehype-img-size';
import rehypeSlug from 'rehype-slug';
import rehypePrism from '@mapbox/rehype-prism';
import glsl from 'vite-plugin-glsl';
import svgr from 'vite-plugin-svgr';
import copy from 'rollup-plugin-copy';
export default defineConfig({
assetsInclude: ['**/*.glb', '**/*.hdr', '**/*.glsl', '**/*.svg'],
optimizeDeps: {
include: [
"isbot",
"@remix-run/react",
"tsparticles",
"@fortawesome/free-brands-svg-icons",
"@fortawesome/free-solid-svg-icons",
"framer-motion",
"react-tsparticles"
],
exclude: [],
ssr: {
noExternal: [
"isbot",
"@remix-run/react",
"tsparticles",
"@fortawesome/free-brands-svg-icons",
"@fortawesome/free-solid-svg-icons",
"framer-motion",
"react-tsparticles"
]
},
},
esbuild: {
treeShaking: true,
},
build: {
assetsInlineLimit: 1024,
manifest: true,
outDir: "build/client",
rollupOptions: {
onwarn(warning, warn) {
if (warning.code === 'UNUSED_EXTERNAL_IMPORT' || warning.message.includes('sideEffects')) {
return;
}
warn(warning);
},
output: {
manualChunks(id) {
if (id.includes('node_modules')) {
if (id.includes('react') || id.includes('react-dom')) {
return;
}
return 'vendor';
}
},
},
plugins: [
copy({
targets: [
{ src: 'public/static/robots.txt', dest: 'build/client/' },
],
hook: 'writeBundle',
}),
],
},
minify: 'terser',
chunkSizeWarningLimit: 4000,
},
resolve: {
alias: {
'~app': resolve(__dirname, 'app'),
},
},
plugins: [
svgr(),
mdx({
rehypePlugins: [[rehypeImgSize, { dir: 'app' }], rehypeSlug, rehypePrism],
remarkPlugins: [remarkFrontmatter, remarkMdxFrontmatter],
providerImportSource: '@mdx-js/react',
}),
remixCloudflareDevProxy(),
remix({
routes(defineRoutes) {
return defineRoutes(route => {
route('/', 'routes/home/route.js', { index: true });
});
},
}),
jsconfigPaths(),
glsl(),
],
});