-
Notifications
You must be signed in to change notification settings - Fork 270
/
vite.config.js
40 lines (36 loc) · 878 Bytes
/
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
import { resolve } from 'path';
import { sveltekit } from '@sveltejs/kit/vite';
import { build } from 'vite';
/** @type {import('vite').Plugin} */
const firebaseSwPlugin = {
name: 'firebaseplugin',
apply: 'build',
enforce: 'post',
buildEnd: async () => {
const conf = {
build: {
lib: {
entry: resolve(__dirname, 'src/firebase-messaging-sw.js'),
formats: ['es'],
},
rollupOptions: {
output: {
entryFileNames: 'firebase-messaging-sw.js',
},
},
outDir: resolve(__dirname, '.svelte-kit/output/client'),
emptyOutDir: false,
},
configFile: false,
};
await build(conf);
},
};
/** @type {import('vite').UserConfig} */
const config = {
build: {
sourcemap: true,
},
plugins: [sveltekit(), firebaseSwPlugin],
};
export default config;