|
| 1 | +import flareSourcemapUploader from '@flareapp/vite'; |
1 | 2 | import tailwindcss from '@tailwindcss/vite'; |
2 | 3 | import react from '@vitejs/plugin-react'; |
3 | 4 | import vue from '@vitejs/plugin-vue'; |
4 | 5 | import { resolve } from 'path'; |
5 | | -import { defineConfig } from 'vite'; |
| 6 | +import { defineConfig, loadEnv } from 'vite'; |
6 | 7 |
|
7 | | -export default defineConfig({ |
8 | | - plugins: [tailwindcss(), react(), vue()], |
9 | | - build: { |
10 | | - rollupOptions: { |
11 | | - input: { |
12 | | - main: resolve(__dirname, 'index.html'), |
13 | | - js: resolve(__dirname, 'js/index.html'), |
14 | | - react: resolve(__dirname, 'react/index.html'), |
15 | | - vue: resolve(__dirname, 'vue/index.html'), |
| 8 | +export default defineConfig(({ mode }) => { |
| 9 | + const env = loadEnv(mode, process.cwd()); |
| 10 | + |
| 11 | + return { |
| 12 | + plugins: [ |
| 13 | + tailwindcss(), |
| 14 | + react(), |
| 15 | + vue(), |
| 16 | + flareSourcemapUploader({ |
| 17 | + key: env.VITE_FLARE_API_KEY, |
| 18 | + }), |
| 19 | + ], |
| 20 | + build: { |
| 21 | + rollupOptions: { |
| 22 | + input: { |
| 23 | + main: resolve(__dirname, 'index.html'), |
| 24 | + js: resolve(__dirname, 'js/index.html'), |
| 25 | + react: resolve(__dirname, 'react/index.html'), |
| 26 | + vue: resolve(__dirname, 'vue/index.html'), |
| 27 | + }, |
16 | 28 | }, |
17 | 29 | }, |
18 | | - }, |
| 30 | + }; |
19 | 31 | }); |
0 commit comments