-
Notifications
You must be signed in to change notification settings - Fork 42
/
vite.config.preload.mjs
29 lines (28 loc) · 1.09 KB
/
vite.config.preload.mjs
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
import { createSingleFile, ENVIRONMENT, getCommonViteConfig, getElectronVendorsCache, sourceEnv } from "./vite.config.common.mjs";
/**
* @type {import('vite').UserConfig}
* @see https://vitejs.dev/config/
*/
export default ({ mode, command }) => {
sourceEnv(ENVIRONMENT);
const cache = getElectronVendorsCache();
const outputFormat = "es";
const config = getCommonViteConfig({ mode: mode || process.env.MODE || "development", command, outputName: "preload", outputFormat: outputFormat });
config.build.emptyOutDir = false;
config.build.ssr = true;
config.build.target = `node${cache.node}`;
config.build.lib = {
name: "preload",
entry: "src/electron-shell/preload.ts",
formats: [outputFormat]
};
// config.build.manifest = true;
config.build.rollupOptions.external = ["electron"];
config.build.rollupOptions.preserveEntrySignatures = "exports-only";
config.build.rollupOptions.output.exports = "auto";
config.build.rollupOptions.output.format = outputFormat;
if (ENVIRONMENT === "production") {
config.plugins.push(createSingleFile(false));
}
return config;
};