-
Notifications
You must be signed in to change notification settings - Fork 11
/
vite.config.js
54 lines (53 loc) · 1.34 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
import { defineConfig } from 'vite';
import copy from 'rollup-plugin-copy';
import { svelte } from '@sveltejs/vite-plugin-svelte';
import path from 'path';
export default defineConfig({
resolve: {
alias: {
'@svelte': path.resolve(__dirname, './src/svelte'),
'@module': path.resolve(__dirname, './src/module'),
'@assets': path.resolve(__dirname, './src/assets')
}
},
build: {
target: 'es2022',
outDir: 'dist',
emptyOutDir: true,
minify: false,
lib: {
name: 'animabf',
entry: 'src/animabf.mjs',
formats: ['es']
},
rollupOptions: {
output: {
preserveModules: true,
preserveModulesRoot: 'src',
entryFileNames: ({ name: fileName }) => {
return `${fileName}.js`;
},
assetFileNames: 'animabf.[ext]'
}
}
},
plugins: [
svelte({
onwarn(warning, defaultHandler) {
if (warning.code.startsWith('a11y')) return;
defaultHandler(warning);
}
}),
copy({
targets: [
{ src: 'src/assets', dest: 'dist' },
{ src: 'src/lang', dest: 'dist' },
{ src: 'packs', dest: 'dist' },
{ src: 'src/templates', dest: 'dist' },
{ src: 'src/system.json', dest: 'dist' },
{ src: 'src/template.json', dest: 'dist' }
],
hook: 'writeBundle'
})
]
});