launchr/vite.config.ts
2024-12-17 18:50:58 -03:00

35 lines
993 B
TypeScript

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { resolve } from 'path';
export default defineConfig({
plugins: [react()],
build: {
outDir: 'dist',
emptyOutDir: true,
rollupOptions: {
input: {
popup: resolve(__dirname, 'index.html'),
background: resolve(__dirname, 'src/background/index.ts'),
content: resolve(__dirname, 'src/content/index.ts')
},
output: {
entryFileNames: (chunkInfo) => {
return chunkInfo.name === 'background' ? 'background.js' :
chunkInfo.name === 'content' ? 'content.js' :
'[name].js';
},
assetFileNames: (assetInfo) => {
const info = assetInfo.name.split('.');
const extType = info[info.length - 1];
if (extType === 'css') {
return 'content.css';
}
return `assets/[name][extname]`;
},
},
},
},
});