-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvite.config.js
56 lines (53 loc) · 1.41 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
import { sveltekit } from '@sveltejs/kit/vite'
import { SvelteKitPWA } from '@vite-pwa/sveltekit'
import { nodePolyfills } from 'vite-plugin-node-polyfills'
import { version } from './package.json'
import { dirname, resolve } from 'path'
import { fileURLToPath } from 'url'
import inject from '@rollup/plugin-inject'
import intlLoader from './intl-plugin'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
/** @type {import('vite').UserConfig} */
const config = {
define: {
'import.meta.env.SEQUEL_APP_VERSION': JSON.stringify(version)
},
test: {
environment: 'jsdom',
coverage: {
provider: 'istanbul'
},
setupFiles: [resolve(__dirname, 'src/tests/setup.js')]
},
plugins: [
intlLoader(),
sveltekit(),
SvelteKitPWA({
outDir: 'dist',
srcDir: './src',
scope: '/',
base: '/',
filename: 'service-worker.js',
workbox: {
sourcemap: true,
globDirectory: 'dist'
},
kit: {
outDir: 'dist'
}
})
// Don't polyfill packages when in test mode because vitest requires node packages to run tests
].concat(process.env.NODE_ENV === 'test' ? [] : [nodePolyfills()]),
resolve: {
alias: {
'node-fetch': './node_modules/node-fetch/browser.js'
}
},
build: {
rollupOptions: {
plugins: [inject({ Buffer: ['buffer', 'Buffer'] })]
}
}
}
export default config