mirror of
https://github.com/fromchat-messenger/web.git
synced 2026-09-22 19:15:08 +03:00
Start the Electron version
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import { app, BrowserWindow } from 'electron';
|
||||
|
||||
app.whenReady().then(() => {
|
||||
const win = new BrowserWindow({
|
||||
title: 'Main window',
|
||||
})
|
||||
|
||||
// You can use `process.env.VITE_DEV_SERVER_URL` when the vite command is called `serve`
|
||||
if (process.env.VITE_DEV_SERVER_URL) {
|
||||
win.loadURL(process.env.VITE_DEV_SERVER_URL)
|
||||
} else {
|
||||
// Load your file
|
||||
win.loadFile('dist/index.html');
|
||||
}
|
||||
});
|
||||
+35
-18
@@ -1,22 +1,39 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import { createHtmlPlugin } from 'vite-plugin-html'
|
||||
import autoprefixer from 'autoprefixer'
|
||||
import { defineConfig, PluginOption } from 'vite';
|
||||
import { createHtmlPlugin } from 'vite-plugin-html';
|
||||
import autoprefixer from 'autoprefixer';
|
||||
import electron from 'vite-plugin-electron/simple';
|
||||
|
||||
const plugins: PluginOption[] = [
|
||||
createHtmlPlugin({
|
||||
minify: {
|
||||
collapseWhitespace: true,
|
||||
removeComments: true,
|
||||
removeRedundantAttributes: true,
|
||||
removeScriptTypeAttributes: true,
|
||||
removeStyleLinkTypeAttributes: true,
|
||||
useShortDoctype: true,
|
||||
minifyCSS: true,
|
||||
minifyJS: true
|
||||
}
|
||||
})
|
||||
]
|
||||
|
||||
if (process.env.VITE_ELECTRON) {
|
||||
plugins.push(
|
||||
electron({
|
||||
main: {
|
||||
entry: "electron/main.ts",
|
||||
},
|
||||
preload: {
|
||||
input: "frontend/electron/preload.ts"
|
||||
},
|
||||
renderer: {},
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
createHtmlPlugin({
|
||||
minify: {
|
||||
collapseWhitespace: true,
|
||||
removeComments: true,
|
||||
removeRedundantAttributes: true,
|
||||
removeScriptTypeAttributes: true,
|
||||
removeStyleLinkTypeAttributes: true,
|
||||
useShortDoctype: true,
|
||||
minifyCSS: true,
|
||||
minifyJS: true
|
||||
}
|
||||
})
|
||||
],
|
||||
plugins: plugins,
|
||||
server: {
|
||||
host: '0.0.0.0',
|
||||
port: 8301,
|
||||
@@ -50,4 +67,4 @@ export default defineConfig({
|
||||
cssMinify: true,
|
||||
assetsInlineLimit: 0
|
||||
}
|
||||
})
|
||||
});
|
||||
Reference in New Issue
Block a user