mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-12-04 20:47:33 +00:00
48 lines
1.0 KiB
JavaScript
48 lines
1.0 KiB
JavaScript
|
import {chrome} from '../../.electron-vendors.cache.json';
|
||
|
import {preload} from 'unplugin-auto-expose';
|
||
|
import {join} from 'node:path';
|
||
|
import {injectAppVersion} from '../../version/inject-app-version-plugin.mjs';
|
||
|
|
||
|
const PACKAGE_ROOT = __dirname;
|
||
|
const PROJECT_ROOT = join(PACKAGE_ROOT, '../..');
|
||
|
|
||
|
/**
|
||
|
* @type {import('vite').UserConfig}
|
||
|
* @see https://vitejs.dev/config/
|
||
|
*/
|
||
|
const config = {
|
||
|
mode: process.env.MODE,
|
||
|
root: PACKAGE_ROOT,
|
||
|
envDir: PROJECT_ROOT,
|
||
|
resolve: {
|
||
|
alias: [
|
||
|
{
|
||
|
find: '@common',
|
||
|
replacement: join(PACKAGE_ROOT, '../common'),
|
||
|
},
|
||
|
],
|
||
|
},
|
||
|
build: {
|
||
|
ssr: true,
|
||
|
sourcemap: 'inline',
|
||
|
target: `chrome${chrome}`,
|
||
|
outDir: 'dist',
|
||
|
assetsDir: '.',
|
||
|
minify: process.env.MODE !== 'development',
|
||
|
lib: {
|
||
|
entry: 'src/index.ts',
|
||
|
formats: ['cjs'],
|
||
|
},
|
||
|
rollupOptions: {
|
||
|
output: {
|
||
|
entryFileNames: '[name].cjs',
|
||
|
},
|
||
|
},
|
||
|
emptyOutDir: true,
|
||
|
reportCompressedSize: false,
|
||
|
},
|
||
|
plugins: [preload.vite(), injectAppVersion()],
|
||
|
};
|
||
|
|
||
|
export default config;
|