-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
50 lines (45 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
50
import { viteExternalsPlugin } from 'vite-plugin-externals';
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
export default defineConfig({
plugins: [
sveltekit(),
viteExternalsPlugin({
fsevents: 'fsevents',
vue: 'Vue',
react: 'React',
'react-dom': 'ReactDOM',
// value support chain, transform to window['React']['lazy']
lazy: ['React', 'lazy'],
}),
],
server: {
fs: {
allow: ['..'],
},
},
base: ".",
build: {
assetsInlineLimit: 0,
rollupOptions: {
external: [/node_modules\/rollup/, /node_modules\/vite/, /node_modules\/fsevents/], // /^node:.*/,
onwarn: (warning, warn) => {
// skip certain warnings
if (warning.code === 'UNUSED_EXTERNAL_IMPORT') return;
if (warning.code?.startsWith('a11y-')) return;
if (warning.id && warning.id.indexOf('node_modules/sveltestrap') >= 0) return;
if (warning.message.indexOf('file-saver') > 0) return;
if (warning.message.indexOf('filepond') > 0) return;
if (warning.code === 'CIRCULAR_DEPENDENCY') {
return;
}
// throw on others
// Using Object.assign over new Error(warning.message) will make the CLI
// print additional information such as warning location and help url.
if (warning.code === 'MISSING_EXPORT') throw Object.assign(new Error(), warning);
// Use default for everything else
warn(warning);
},
},
},
});