mirror of
https://github.com/antebudimir/feishin.git
synced 2025-12-31 18:13:31 +00:00
add vite build for web
This commit is contained in:
parent
ac682428e6
commit
6463ea937b
4 changed files with 52 additions and 4 deletions
|
|
@ -3,6 +3,7 @@ import { externalizeDepsPlugin, UserConfig } from 'electron-vite';
|
|||
import { resolve } from 'path';
|
||||
import conditionalImportPlugin from 'vite-plugin-conditional-import';
|
||||
import dynamicImportPlugin from 'vite-plugin-dynamic-import';
|
||||
import { ViteEjsPlugin } from 'vite-plugin-ejs';
|
||||
|
||||
const currentOSEnv = process.platform;
|
||||
|
||||
|
|
@ -49,7 +50,7 @@ const config: UserConfig = {
|
|||
localsConvention: 'camelCase',
|
||||
},
|
||||
},
|
||||
plugins: [react()],
|
||||
plugins: [react(), ViteEjsPlugin({ web: false })],
|
||||
resolve: {
|
||||
alias: {
|
||||
'/@/i18n': resolve('src/i18n'),
|
||||
|
|
|
|||
|
|
@ -20,9 +20,10 @@
|
|||
},
|
||||
"main": "./out/main/index.js",
|
||||
"scripts": {
|
||||
"build": "pnpm run typecheck && pnpm run build:app && pnpm run build:remote",
|
||||
"build:app": "electron-vite build",
|
||||
"build": "pnpm run typecheck && pnpm run build:electron && pnpm run build:remote",
|
||||
"build:electron": "electron-vite build",
|
||||
"build:remote": "vite build --config remote.vite.config.ts",
|
||||
"build:web": "vite build --config web.vite.config.ts",
|
||||
"dev": "electron-vite dev",
|
||||
"dev:watch": "electron-vite dev --watch",
|
||||
"format": "prettier --write .",
|
||||
|
|
|
|||
|
|
@ -6,7 +6,10 @@
|
|||
<meta http-equiv="Content-Security-Policy" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Feishin</title>
|
||||
<script src="settings.js"></script>
|
||||
<% if (web) { %>
|
||||
<link rel="icon" href="./assets/favicon.ico">
|
||||
<script src="settings.js"></script>
|
||||
<% } %>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
|
|
|||
43
web.vite.config.ts
Normal file
43
web.vite.config.ts
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
import react from '@vitejs/plugin-react';
|
||||
import path from 'path';
|
||||
import { defineConfig, normalizePath } from 'vite';
|
||||
import { ViteEjsPlugin } from 'vite-plugin-ejs';
|
||||
|
||||
export default defineConfig({
|
||||
base: './',
|
||||
build: {
|
||||
emptyOutDir: true,
|
||||
outDir: path.resolve(__dirname, './out/web'),
|
||||
rollupOptions: {
|
||||
input: {
|
||||
favicon: normalizePath(path.resolve(__dirname, './assets/icons/favicon.ico')),
|
||||
index: normalizePath(path.resolve(__dirname, './src/renderer/index.html')),
|
||||
},
|
||||
output: {
|
||||
assetFileNames: 'assets/[name].[ext]',
|
||||
},
|
||||
},
|
||||
},
|
||||
css: {
|
||||
modules: {
|
||||
generateScopedName: '[name]__[local]__[hash:base64:5]',
|
||||
localsConvention: 'camelCase',
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
react(),
|
||||
ViteEjsPlugin({
|
||||
root: normalizePath(path.resolve(__dirname, './src/renderer')),
|
||||
web: true,
|
||||
}),
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
'/@/i18n': path.resolve(__dirname, './src/i18n'),
|
||||
'/@/remote': path.resolve(__dirname, './src/remote'),
|
||||
'/@/renderer': path.resolve(__dirname, './src/renderer'),
|
||||
'/@/shared': path.resolve(__dirname, './src/shared'),
|
||||
},
|
||||
},
|
||||
root: path.resolve(__dirname, './src/renderer'),
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue