forked from sveltia/sveltia-cms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
54 lines (53 loc) · 1.44 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 { svelte } from '@sveltejs/vite-plugin-svelte';
import path from 'path';
import { visualizer } from 'rollup-plugin-visualizer';
import { sveltePreprocess } from 'svelte-preprocess';
import { defineConfig } from 'vite';
// https://vitejs.dev/config/
export default defineConfig({
resolve: {
alias: {
$lib: path.resolve('./src/lib/'),
},
extensions: ['.js', '.svelte'],
},
build: {
target: 'es2022',
chunkSizeWarningLimit: 5000,
sourcemap: true,
rollupOptions: {
// Output JavaScript only
input: 'src/main.js',
output: [
{
entryFileNames: 'sveltia-cms.js',
format: 'iife',
},
{
entryFileNames: 'sveltia-cms.mjs',
format: 'es',
},
],
// Keep exports in the ES module
// https://stackoverflow.com/q/71500190
preserveEntrySignatures: 'strict',
},
},
// https://esbuild.github.io/api/#legal-comments
esbuild: { legalComments: 'eof' },
plugins: [
svelte({
emitCss: false,
preprocess: sveltePreprocess(),
compilerOptions: {
// Silence a warning on `<svelte:options accessors={true} />`
// eslint-disable-next-line jsdoc/require-jsdoc
warningFilter: (warning) => warning.code !== 'options_deprecated_accessors',
},
}),
// https://www.npmjs.com/package/rollup-plugin-visualizer
visualizer({
filename: '.vite/stats.html',
}),
],
});