Files
max-index/vite.renderer.config.ts

30 lines
974 B
TypeScript

import path from 'node:path';
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';
export default defineConfig(({ mode }) => {
const contentSecurityPolicy =
mode === 'development'
? "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; connect-src 'self' ws://localhost:*"
: "default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; connect-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'";
return {
root: path.resolve(__dirname, 'src/renderer'),
plugins: [
react(),
{
name: 'max-index-content-security-policy',
transformIndexHtml: (html) =>
html.replace(
'__MAX_INDEX_CONTENT_SECURITY_POLICY__',
contentSecurityPolicy,
),
},
],
build: {
emptyOutDir: false,
outDir: path.resolve(__dirname, '.vite/renderer/main_window'),
},
};
});