-
Notifications
You must be signed in to change notification settings - Fork 407
/
vite.config.ts
70 lines (65 loc) · 1.61 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/// <reference types="vitest" />
/// <reference types="vite/client" />
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';
import { resolve } from 'path';
import { version } from './package.json';
import { visualizer } from 'rollup-plugin-visualizer';
import typescript from '@rollup/plugin-typescript';
console.log(`ReactFire v${version}`);
const externals = [
'react',
'firebase',
'firebase/app',
'firebase/firestore',
'firebase/firestore/lite',
'firebase/auth',
'firebase/functions',
'firebase/storage',
'firebase/database',
'firebase/remote-config',
'firebase/performance',
'@firebase/app',
'@firebase/firestore',
'@firebase/firestore/lite',
'@firebase/auth',
'@firebase/functions',
'@firebase/storage',
'@firebase/database',
'@firebase/remote-config',
'@firebase/performance',
];
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
react(),
typescript(),
// Visualize the bundle in `stats.html`.
// Helps make sure we aren't pulling in extra deps
visualizer({ template: 'treemap' }),
],
test: {
globals: true,
environment: 'jsdom',
setupFiles: './test/setupTests.ts',
},
define: {
// replace `process.env.REACTFIRE_VERSION` in the source
// for usage stats
'process.env.REACTFIRE_VERSION': JSON.stringify(version),
},
build: {
lib: {
entry: resolve(__dirname, 'src/index.ts'),
name: 'ReactFire',
fileName: 'index',
},
rollupOptions: {
external: externals,
output: {
globals: { react: 'React' },
},
},
sourcemap: true,
},
});