-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
33 lines (31 loc) · 962 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
import { defineConfig, loadEnv } from 'vite';
import { resolve } from 'path';
const chromePlugin = resolve(__dirname, 'src/chrome-plugin');
export default defineConfig(({ mode }) => {
// Load environment variables based on mode (development, production, etc.)
const env = loadEnv(mode, process.cwd());
console.log('VITE_MINIFY', env.VITE_MINIFY);
return {
build: {
minify: env.VITE_MINIFY === 'true', // Use your custom env variable
target: 'esnext',
modulePreload: {
polyfill: false,
},
outDir: 'build/chrome-plugin',
rollupOptions: {
input: {
content: resolve(chromePlugin, 'content.js'),
background: resolve(chromePlugin, 'background.js'),
},
output: {
entryFileNames: '[name].js',
format: 'es'
},
},
},
define: {
'process.env': env, // Pass the environment variables to process.env if needed
},
};
});