// @ts-check /* eslint-env node */ import { builtinModules } from 'module'; import { join } from 'path'; import react from '@vitejs/plugin-react'; // `resolveJsonModule` is disabled for this package, but vite will load the json nevertheless. // @ts-expect-error import { chrome } from '../../.electron-vendors.cache.json'; /** @type string */ const PACKAGE_ROOT = __dirname; /** * @type {import('vite').UserConfig} * @see https://vitejs.dev/config/ */ const config = { mode: process.env.MODE, root: PACKAGE_ROOT, resolve: { alias: { '/@/': join(PACKAGE_ROOT, 'src') + '/', }, }, plugins: [ react(), ], base: '', server: { fs: { strict: true, }, }, build: { sourcemap: true, target: `chrome${chrome}`, outDir: 'dist', assetsDir: '.', rollupOptions: { external: [ ...builtinModules, ], }, emptyOutDir: true, brotliSize: false, }, }; export default config;