Giter Club home page Giter Club logo

jooy2 / vutron Goto Github PK

View Code? Open in Web Editor NEW
203.0 3.0 17.0 2.84 MB

💚 Quick Start Templates for Vite + Electron + Vue 3 + Vuetify + TypeScript. Vutron is a preconfigured template for developing Electron cross-platform desktop apps. It uses Vue 3 and allows you to build a fast development environment with little effort.

Home Page: https://vutron.jooy2.com

License: MIT License

Vue 26.27% HTML 0.69% TypeScript 64.24% JavaScript 8.79%
electron electron-vue template vue vue3 vuejs3 boilerplate boilerplate-template skeleton vuetify

vutron's Introduction

vutron-logo


Quick Start Templates for Vite + Vue 3 + Electron

awesome-vite license Stars Commit Count Followers

vutron-logo

English · 한국어 · 简体中文

Vutron is a preconfigured template for developing Electron cross-platform desktop apps. It uses Vue 3 and allows you to build a fast development environment with little effort.

Advantages of use

  • ✅ You can build immediately without any presets, so you can develop quickly.
  • ✅ It is being maintained quickly to be compatible with the latest Vue and Electron, as well as many modules.
  • ✅ There is no need to worry about layout and data management by using various additional templates.

Features

  • ⚡️ Rapid development through hot-reload
  • ⚡️ Cross-platform development and build support
  • ⚡️ Support for automated application testing
  • ⚡️ TypeScript support
  • ⚡️ Multilingual support
  • ⚡️ Support for themes (dark & light)
  • ⚡️ Basic layout manager
  • ⚡️ Global state management through the Pinia store
  • ⚡️ Quick support through the GitHub community and official documentation

For complete documentation including installation instructions and basic usage, please refer to each item in the link below: https://vutron.jooy2.com/installation-and-build/getting-started

Contribute

You can report issues on GitHub Issue. You can also request a pull to fix bugs and add frequently used features.

License

Copyright © 2022-2024 Jooy2 <[email protected]> Released under the MIT license.

vutron's People

Contributors

dependabot[bot] avatar good1uck avatar jooy2 avatar lnrdnl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vutron's Issues

in development some images can be show in my project but when i use npm run build:win these images can't show

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

Expected behavior
A clear and concise description of what you expected to happen.

Device information (please complete the following information):

  • OS Name: [e.g. Windows, macOS, Linux...]
  • OS Version: [e.g. 11, 10.14...]

Screenshots & Attachments
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Cannot build on Ubuntu 22.04 Windows WSL2: Cannot find module 'dmg-license'

Describe the bug
Just clone, install, and build. Cannot build.

To Reproduce

  1. clone
  2. npm i
  3. npm run build

Expected behavior
Build something, like bin files

Device information (please complete the following information):

  • OS Name: Ubuntu 22.04 on WSL2
  • OS Version: 22.04

Screenshots & Attachments

# emil @ Ubuntu-2204-WSL2 in ~/Developments/Github/vutron on git:master o [22:44:28] 
$ npm i
npm WARN deprecated @types/[email protected]: This is a stub types definition. jszip provides its own type definitions, so you do not need this installed.

added 652 packages, and audited 653 packages in 4s

153 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

# emil @ Ubuntu-2204-WSL2 in ~/Developments/Github/vutron on git:master o [22:44:33] 
$ npm run build

> [email protected] build
> npm run build:pre && electron-builder --config=buildAssets/builder/config.ts -wml


> [email protected] build:pre
> npm run format:fix && vue-tsc --noEmit && vite build


> [email protected] format:fix
> prettier . --write

.eslintrc.json 21ms
.prettierrc 11ms
buildAssets/builder/config.ts 86ms
CODE_OF_CONDUCT.md 30ms
docs/package.json 1ms
docs/src/.vitepress/config.mts 6ms
docs/src/automated-testing.md 5ms
docs/src/build-configuration.md 7ms
docs/src/getting-started.md 6ms
docs/src/install-local-documentation.md 2ms
docs/src/main-and-renderer-process.md 7ms
docs/src/npm-scripts.md 7ms
docs/src/other-projects.md 2ms
docs/src/pre-configured-components.md 2ms
docs/src/project-structure.md 2ms
docs/tsconfig.json 1ms
package.json 1ms
playwright.config.ts 1ms
README.ko-KR.md 9ms
README.md 5ms
README.zh-CN.md 8ms
src/main/index.ts 7ms
src/main/IPCs.ts 4ms
src/main/MainRunner.ts 9ms
src/main/utils/Constants.ts 3ms
src/main/utils/Menus.ts 2ms
src/preload/index.ts 4ms
src/renderer/App.vue 22ms
src/renderer/components/layout/DefaultLayout.vue 2ms
src/renderer/components/layout/HeaderLayout.vue 11ms
src/renderer/components/layout/index.ts 1ms
src/renderer/index.html 1ms
src/renderer/locales/de.json 1ms
src/renderer/locales/en.json 1ms
src/renderer/locales/es.json 1ms
src/renderer/locales/fr.json 0ms
src/renderer/locales/ja.json 1ms
src/renderer/locales/ko.json 1ms
src/renderer/locales/pt.json 0ms
src/renderer/locales/ru.json 1ms
src/renderer/locales/zh-hans.json 1ms
src/renderer/locales/zh-hant.json 1ms
src/renderer/main.ts 2ms
src/renderer/plugins/i18n.ts 1ms
src/renderer/plugins/vuetify.ts 2ms
src/renderer/router/index.ts 1ms
src/renderer/screens/ErrorScreen.vue 1ms
src/renderer/screens/index.ts 0ms
src/renderer/screens/MainScreen.vue 16ms
src/renderer/screens/SecondScreen.vue 1ms
src/renderer/store/counter.ts 2ms
src/renderer/utils/index.ts 2ms
src/vue-shim.d.ts 1ms
tests/app.spec.ts 5ms
tsconfig.json 1ms
tsconfig.node.json 1ms
vite.config.ts 4ms
vite v4.4.9 building for production...
✓ 308 modules transformed.
../../dist/index.html                                      0.26 kB │ gzip:   0.19 kB
../../dist/materialdesignicons-webfont-c1c004a9.woff2    396.73 kB
../../dist/materialdesignicons-webfont-80bb28b3.woff     576.75 kB
../../dist/materialdesignicons-webfont-a58ecb54.ttf    1,279.99 kB
../../dist/materialdesignicons-webfont-67d24abe.eot    1,280.21 kB
../../dist/index-54c5d3cf.css                            631.54 kB │ gzip:  91.62 kB
../../dist/index-81511a61.js                             331.95 kB │ gzip: 115.91 kB
✓ built in 1.71s
vite v4.4.9 building for production...
✓ 346 modules transformed.
dist/main/index.js  280.33 kB │ gzip: 86.07 kB
✓ built in 680ms
vite v4.4.9 building for production...
✓ 1 modules transformed.
dist/preload/index.js  0.61 kB │ gzip: 0.32 kB
✓ built in 6ms
  • electron-builder  version=24.6.4 os=5.15.90.1-microsoft-standard-WSL2
compiling: [
  '/home/emil/Developments/Github/vutron/buildAssets/builder/config.ts'
]
  • loaded configuration  file=/home/emil/Developments/Github/vutron/buildAssets/builder/config.ts
  • writing effective config  file=release/1.0.0/builder-effective-config.yaml
  ⨯ Cannot find module 'dmg-license'
Require stack:
- /home/emil/Developments/Github/vutron/node_modules/dmg-builder/out/dmgLicense.js
- /home/emil/Developments/Github/vutron/node_modules/dmg-builder/out/dmg.js
- /home/emil/Developments/Github/vutron/node_modules/dmg-builder/out/dmgUtil.js
- /home/emil/Developments/Github/vutron/node_modules/app-builder-lib/out/macPackager.js
- /home/emil/Developments/Github/vutron/node_modules/app-builder-lib/out/packager.js
- /home/emil/Developments/Github/vutron/node_modules/app-builder-lib/out/index.js
- /home/emil/Developments/Github/vutron/node_modules/electron-builder/out/builder.js
- /home/emil/Developments/Github/vutron/node_modules/electron-builder/out/cli/cli.js
- /home/emil/Developments/Github/vutron/node_modules/electron-builder/cli.js  failedTask=build stackTrace=Error: Cannot find module 'dmg-license'
Require stack:
- /home/emil/Developments/Github/vutron/node_modules/dmg-builder/out/dmgLicense.js
- /home/emil/Developments/Github/vutron/node_modules/dmg-builder/out/dmg.js
- /home/emil/Developments/Github/vutron/node_modules/dmg-builder/out/dmgUtil.js
- /home/emil/Developments/Github/vutron/node_modules/app-builder-lib/out/macPackager.js
- /home/emil/Developments/Github/vutron/node_modules/app-builder-lib/out/packager.js
- /home/emil/Developments/Github/vutron/node_modules/app-builder-lib/out/index.js
- /home/emil/Developments/Github/vutron/node_modules/electron-builder/out/builder.js
- /home/emil/Developments/Github/vutron/node_modules/electron-builder/out/cli/cli.js
- /home/emil/Developments/Github/vutron/node_modules/electron-builder/cli.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
    at Function.Module._load (node:internal/modules/cjs/loader:901:27)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18)
    at Object.<anonymous> (/home/emil/Developments/Github/vutron/node_modules/dmg-builder/src/dmgLicense.ts:7:1)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Function.Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18)
    at Object.<anonymous> (/home/emil/Developments/Github/vutron/node_modules/dmg-builder/src/dmg.ts:13:1)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Function.Module._load (node:internal/modules/cjs/loader:938:12)

# emil @ Ubuntu-2204-WSL2 in ~/Developments/Github/vutron on git:master o [22:44:46] C:1
$ 

Additional context
Add any other context about the problem here.

MaxListenersExceededWarning because of window.mainApi.receive

MaxListenersExceededWarning
In the template a listener for msgReceivedVersion is registered. But this happens every time the component is mounted. So when switching from screen to screen 12 times, you'll get a warning. This is a possible memory leak.

To Reproduce
Switch from Main to Second at least 12 times.

Expected behavior
Listeners should be registered only once or destroyed on onUnmounted() (I guess)

Device information (please complete the following information):

  • OS Name: macOS
  • OS Version: Sonoma 14.2.1 (M1 Pro 2021)

Run dev

Hi,
i have problem with npm run dev.

After npm install i try to run npm run dev and Im getting this

vite v3.2.3 building for development...

watching for file changes...

build started...
transforming (1) src/main/index.tsdist/preload/index.js 0.07 KiB / gzip: 0.08 KiB
built in 97ms.
transforming (5) node_modules/@electron/remote/dist/src/main/objects-registry.jsError launching app
Unable to find Electron app at /home/ibakran/Downloads/vutron-master

Cannot find module '/home/ibakran/Downloads/vutron-master/dist/main/index.js'. Please verify that the package.json has a valid "main" entry
✓ 24 modules transformed.

Thanks

Ignore

I'm stupid, didnt see the Node v17 requirement

Clone the project
Run npm i
Run npm run dev
Receive the following error:

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".json" for C:\Users\Reiss\ControlVisualiser\nw\package.json
    at new NodeError (node:internal/errors:371:5)
    at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:87:11)
    at defaultGetFormat (node:internal/modules/esm/get_format:102:38)
    at defaultLoad (node:internal/modules/esm/load:21:14)
    at ESMLoader.load (node:internal/modules/esm/loader:359:26)
    at ESMLoader.moduleProvider (node:internal/modules/esm/loader:280:58)
    at new ModuleJob (node:internal/modules/esm/module_job:66:26)
    at ESMLoader.#createModuleJob (node:internal/modules/esm/loader:297:17)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:261:34)
    at async ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:81:21) {
  code: 'ERR_UNKNOWN_FILE_EXTENSION'
}

Node Version: v16.14.2
NPM Version: 8.5.0
OS: Windows 10

[Feature Request] Please Add a Test Framework

Thank you for creating this template. I have been experimenting with different frameworks when deciding on the framework for my next project and your template has accelerated that research time. One thing that seems a little complex is integrating testing into this specific environment. Especially since this aims to be a production-ready template, I think that it should include a template for testing. Because Spectron is deprecated, I would assume it would use Vitest for writing tests and WebdriverIO to run the tests in an Electron environment.

This is a feature I'm willing to bounty or make a sponsor for. I look forward to hearing your thoughts on this!

Error launching app when adding third party libs in main process

Description
Adding a library in the main process prevents cold start with npm run dev:debug.
The problem occurs after the first actual call to the new library and not during hot reload.

Reproduction
To reproduce, install a fresh vutron install:

npm init vutron
cd vutron
yarn install
npm run dev:debug

At this point, we have a working clean example, as documented in the quickstart.

Now I add got for instance, and call it in ./src/main/index.ts

yarn install got
vi src/main/index.ts

And I add at the end of the import section

import got from "got";

got.get("http://google.com").then();

At this point, vite recompiles into dist/main and restart electron.

Now, if I stop and restart the dev:debug script, it will fail without many explanations.

^C
npm run dev:debug
# ...
build started... (x2)
✓ 1 modules transformed.
dist/preload/index.js  0.61 kB │ gzip: 0.32 kB
built in 212ms.
transforming (32) node_modules/form-data-encoder/lib/FormDataEncoder.jsError launching app
Unable to find Electron app at /home2/work/vutron

Cannot find module '/home2/work/vutron/dist/main/index.js'. Please verify that the package.json has a valid "main" entry

It is correct that there is no such file, the whole dist/main is missing, as if the compilation failed after cleaning the output directory.

Expected behavior
I expected that hot reload or cold start of my application behaved the same, without compilation failure on cold start.

System

  • OS: linux (debian unstable on amd64)
  • Node: v18.13.0

Additional context
This bug seems similar to the previous #7
I had the same issues with Axios or pdf-lib as third party library.

I don't see how to gather further logs to explain why vite fails in this situation, but I'm available to answer further questions.

Thanks in advance for looking at this issue.

suggestion: provide an overview of the files in the template

Describe the bug
Its not a bug :-)

for someone new to electron like me, like me, it would be useful to have in the documenation a section on pointers on the layout of the files in the template and where to begin customising this template.

To Reproduce
n/a

Expected behavior
n/a

Screenshots
n/a

Desktop (please complete the following information):
n/a

Additional context
I love that this works immediately! ive come across a lot of templates that didnt work first time. excellent work!

npm run dev failed : 'ELECTRON_ENABLE_LOGGING' is not recognized as an internal or external command

Describe the bug
I have installed the pachage through the "NPM INIT VUTRON" it completed succesfully but throwing the error 'ELECTRON_ENABLE_LOGGING' is not recognized as an internal or external command

CMD

\web\lab\vutron>npm run dev

[email protected] dev
ELECTRON_ENABLE_LOGGING=true vite

'ELECTRON_ENABLE_LOGGING' is not recognized as an internal or external command,
operable program or batch file.

Device information (please complete the following information):

  • OS Name: WINDOWS 11
  • npm version: 9.6.7

add discussions to this git repo

Hello this is not a bug.

Please can git discussions be enabled for this repo so that the user community can engage and share ideas without raising issues.
This is easily enabled by ticking the Discussions checkbox under Settings>General>Features

image

in production how to build two html entrance

i make a pron japanese game (galgame) translator and i want to use vite to buidl two entrance like it:
import { fileURLToPath, URL } from 'url'
import { defineConfig, loadEnv } from 'vite'
import ElectronPlugin, { ElectronOptions } from 'vite-plugin-electron'
import RendererPlugin from 'vite-plugin-electron-renderer'
import VuetifyPlugin from 'vite-plugin-vuetify'
import VueJsx from '@vitejs/plugin-vue-jsx'
import Vue from '@vitejs/plugin-vue'
import EslintPlugin from 'vite-plugin-eslint'
import { rmSync } from 'fs'
import { resolve, dirname } from 'path'
import { builtinModules } from 'module'
const isDevEnv = process.env.NODE_ENV === 'development'

export default defineConfig(({ mode }) => {
process.env = {
...(isDevEnv
? {
ELECTRON_ENABLE_LOGGING: 'true'
}
: {}),
...process.env,
...loadEnv(mode, process.cwd())
}

rmSync('dist', { recursive: true, force: true })

const electronPluginConfigs: ElectronOptions[] = [
{
entry: 'src/main/index.ts',
onstart({ startup }) {
startup()
},
vite: {
build: {
assetsDir: '.',
outDir: resolve(__dirname, 'dist/main'),
sourcemap: isDevEnv,
minify: !isDevEnv,
rollupOptions: {
plugins: [
require('@rollup/plugin-alias')({
entries: [{ find: '@', replacement: resolve(__dirname, 'src') }]
})
],
external: ['electron', ...builtinModules, 'koffi']
}
}
}
},
{
entry: 'src/preload/index.ts',
onstart({ reload }) {
reload()
},
vite: {
resolve: {
alias: {
'@': resolve(dirname(fileURLToPath(import.meta.url)), 'src')
}
},
build: {
outDir: 'dist/preload'
}
}
}
]

if (isDevEnv) {
electronPluginConfigs.push({
entry: 'src/main/index.dev.ts',
vite: {
build: {
outDir: 'dist/main'
}
}
})
}

return {
define: {
VUE_I18N_FULL_INSTALL: true,
VUE_I18N_LEGACY_API: false,
INTLIFY_PROD_DEVTOOLS: false
},
resolve: {
extensions: ['.mjs', '.js', '.ts', '.vue', '.json', '.scss'],
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
base: './',
root: resolve(__dirname, 'src/renderer'),
publicDir: resolve(__dirname, './src/renderer/public'),
clearScreen: false,
build: {
sourcemap: isDevEnv,
minify: !isDevEnv,
outDir: resolve('./dist'),
rollupOptions: {
input: {
main: 'index.html', //this is vite input
translator: '../translator/index.html',
}
}
},
server: {
hmr: true
},
plugins: [
Vue(),
VueJsx(),
// Docs: https://github.com/vuetifyjs/vuetify-loader
VuetifyPlugin({
autoImport: true
}),
// EslintPlugin(),
// Docs: https://github.com/electron-vite/vite-plugin-electron
ElectronPlugin(electronPluginConfigs),
RendererPlugin()
]
}
})
but its wrong :Could not resolve entry module "../translator/index.html".
error during build:
RollupError: Could not resolve entry module "../translator/index.html".
at error (file:///D:/nodejs/node_globle/node_modules/vite/node_modules/rollup/dist/es/shared/parseAst.js:337:30)
at ModuleLoader.loadEntryModule (file:///D:/nodejs/node_globle/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:17957:20)
at async Promise.all (index 1)
how to resolve it? i really need it

electron-rebuild work failed

I use opencv4nodejs in vutron, and when I use electron-rebuild to rebuild opencv4nodejs, encountering error :

`

vutron/node_modules/cliui/build/index.cjs:293
const wrap = require('wrap-ansi');

require() of ES Module vutron/node_modules/wrap-ansi/index.js from vutron/node_modules/cliui/build/index.cjs not supported
Instead change the require of index.js in vutron/node_modules/cliui/build/index.cjs to a dynamic import() which is available in all CommonJS modules.
at Object. (vutron/node_modules/cliui/build/index.cjs:293:14)
at Object. (vutron/node_modules/yargs/build/index.cjs:1:60678)
at Object. (vutron/node_modules/yargs/yargs:3:69)
at Object. (vutron/node_modules/@electron/rebuild/lib/cli.js:34:33) {
code: 'ERR_REQUIRE_ESM'
}
`

I don't know how to fix it.

Troubles with build

Describe the bug
Have error "ERROR: Cannot create symbolic link" on build
On npm run build:win have this output:

To ensure your native dependencies are always matched electron version, simply add script `"postinstall": "electron-builder install-app-deps" to your `package.json`
  • writing effective config  file=release\0.0.1\builder-effective-config.yaml
  • rebuilding native dependencies  [email protected], [email protected] platform=win32 arch=x64
  • packaging       platform=win32 arch=x64 electron=27.1.3 appOutDir=release\0.0.1\win-unpacked
  • downloading     url=https://github.com/electron-userland/electron-builder-binaries/releases/download/winCodeSign-2.6.0/winCodeSign-2.6.0.7z size=5.6 MB parts=1
  • downloaded      url=https://github.com/electron-userland/electron-builder-binaries/releases/download/winCodeSign-2.6.0/winCodeSign-2.6.0.7z duration=2.821s
  ⨯ cannot execute  cause=exit status 2
                    out=
    7-Zip (a) 21.07 (x64) : Copyright (c) 1999-2021 Igor Pavlov : 2021-12-26

    Scanning the drive for archives:
    1 file, 5635384 bytes (5504 KiB)

    Extracting archive: C:\Users\dimquea\AppData\Local\electron-builder\Cache\winCodeSign\305920359.7z
    --
    Path = C:\Users\dimquea\AppData\Local\electron-builder\Cache\winCodeSign\305920359.7z
    Type = 7z
    Physical Size = 5635384
    Headers Size = 1492
    Method = LZMA2:24m LZMA:20 BCJ2
    Solid = +
    Blocks = 2


    Sub items Errors: 2

    Archives with Errors: 1

    Sub items Errors: 2

                    errorOut=ERROR: Cannot create symbolic link : ������ �� �������� �ॡ㥬묨 �ࠢ���. : C:\Users\dimquea\AppData\Local\electron-builder\Cache\winCodeSign\3059200359\darwin\10.12\lib\libcrypto.dylib
    ERROR: Cannot create symbolic link : ������ �� �������� �ॡ㥬묨 �ࠢ���. : C:\Users\dimquea\AppData\Local\electron-builder\Cache\winCodeSign\305920359\darwin\10.12\lib\libsssl.dylib

                    command='C:\Users\dimquea\Projects\vutron\node_modules\7zip-bin\win\x64\7za.exe' x -bd 'C:\Users\dimquea\AppData\Local\electron-builder\Cache\winCodeSign\305920359.7z' '-oC:\Users\dimquea\AppData\Local\electron-builder\Cache\winCodeSign\305920359'
                    workingDir=C:\Users\dimquea\AppData\Local\electron-builder\Cache\winCodeSign
  • Above command failed, retrying 3 more times
  • downloading     url=https://github.com/electron-userland/electron-builder-binaries/releases/download/winCodeSign-2.6.0/winCodeSign-2.6.0.7z size=5.6 MB parts=1
  • downloaded      url=https://github.com/electron-userland/electron-builder-binaries/releases/download/winCodeSign-2.6.0/winCodeSign-2.6.0.7z duration=3.314s
  ⨯ cannot execute  cause=exit status 2
                    out=

and some other repeat

To Reproduce
run npm run build:win

Expected behavior
complete build

Device information (please complete the following information):

  • Windows 11 pro
  • node 18.17.0

Screenshots & Attachments
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Linux build question

hello when I build linux ,it have a mistake

• cannot get, wait  error=Get "https://service.electron.build/find-build-agent?no-cache=1hl9o7p": dial tcp 51.15.76.176:443: connectex: No connection could be made because the target machine actively refused it.
                      attempt=2
                      waitTime=6
  ⨯ Get "https://service.electron.build/find-build-agent?no-cache=1hl9o7p": dial tcp 51.15.76.176:443: connectex: No connection could be made because the target machine actively refused it.
  ⨯ Cannot cleanup:

Error #1 --------------------------------------------------------------------------------
Error: Please specify project homepage, see https://electron.build/configuration/configuration#Metadata-homepage
    at FpmTarget.computeFpmMetaInfoOptions (C:\tools\5.coding\nvm\Vue\vutron\node_modules\app-builder-lib\src\targets\fpm.ts:86:13)
    at RemoteTarget.doBuild (C:\tools\5.coding\nvm\Vue\vutron\node_modules\app-builder-lib\src\linuxPackager.ts:116:5)

so what's mean. and how could i fix it,thank you

can't find the right file path

in developer environment, my project is no issue,
this is my electron Tray
app.whenReady().then(() => {
let pathyuki: string
let homeyuki: string
let exityuiki: string
if (Constants.IS_DEV_ENV) {
pathyuki = path.join(__dirname, '../../src/renderer/public/images/whiteyuki.png')
homeyuki = path.join(__dirname, '../../src/renderer/public/images/home.png')
exityuiki = path.join(__dirname, '../../src/renderer/public/images/exit.png')
} else {
pathyuki = path.join(process.resourcesPath, 'app.asar/src/renderer/public/images/whiteyuki.png')
homeyuki = path.join(process.resourcesPath, 'app.asar/src/renderer/public/images/home.png')
exityuiki = path.join(process.resourcesPath, 'app.asar/src/renderer/public/images/exit.png')
}
let tray = new Tray(pathyuki)
const contextMenu = Menu.buildFromTemplate([
{
label: '打开主界面',
icon: homeyuki,
click: function () {
mainWindow.show()
}
},
{
label: '退出',
icon: exityuiki,
click: function () {
app.quit()
}
}
])
tray.setToolTip('YuKiGalGamePro')
tray.setTitle('YuKiGalGamePro')
tray.setContextMenu(contextMenu)
tray.on('click', () => {
mainWindow.show()
})
})
i set the png as icon
this is my image file:
image
but when i use npm run build:win i try to run it,the image is fade!
this is my tsconfig.json:
{
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist",
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"jsx": "preserve",
"allowJs": true,
"noImplicitAny": false,
"allowSyntheticDefaultImports": true,
"declaration": false,
"resolveJsonModule": true,
"esModuleInterop": true,
"sourceMap": true,
"strict": true,
"skipLibCheck": true,
"typeRoots": ["./node_modules/@types", "./src/types"],
"types": ["node", "debug"],
"paths": {
"@/": ["./src/"]
},
"lib": ["esnext", "dom"]
},
"include": [
"src//",
"package.json",
"vite.config.ts",
"buildAssets/builder",
"src/renderer/locales/
.json"
],
"exclude": ["node_modules", "
/*.spec.ts"]
}
and vite.config.ts:
import { fileURLToPath, URL } from 'url'
import { defineConfig, loadEnv } from 'vite'
import ElectronPlugin, { ElectronOptions } from 'vite-plugin-electron'
import RendererPlugin from 'vite-plugin-electron-renderer'
import VuetifyPlugin from 'vite-plugin-vuetify'
import VueJsx from '@vitejs/plugin-vue-jsx'
import Vue from '@vitejs/plugin-vue'
import EslintPlugin from 'vite-plugin-eslint'
import { rmSync } from 'fs'
import { resolve, dirname } from 'path'
import { builtinModules } from 'module'
const isDevEnv = process.env.NODE_ENV === 'development'

export default defineConfig(({ mode }) => {
process.env = {
...(isDevEnv
? {
ELECTRON_ENABLE_LOGGING: 'true'
}
: {}),
...process.env,
...loadEnv(mode, process.cwd())
}

rmSync('dist', { recursive: true, force: true })

const electronPluginConfigs: ElectronOptions[] = [
{
entry: 'src/main/index.ts',
onstart({ startup }) {
startup()
},
vite: {
build: {
assetsDir: '.',
outDir: 'dist/main',
rollupOptions: {
plugins: [
require('@rollup/plugin-alias')({
entries: [{ find: '@', replacement: resolve(__dirname, 'src') }]
})
],
external: ['electron', ...builtinModules, 'koffi']
}
}
}
},
{
entry: 'src/preload/index.ts',
onstart({ reload }) {
reload()
},
vite: {
resolve: {
alias: {
'@': resolve(dirname(fileURLToPath(import.meta.url)), 'src')
}
},
build: {
outDir: 'dist/preload'
}
}
}
]

if (isDevEnv) {
electronPluginConfigs.push({
entry: 'src/main/index.dev.ts',
vite: {
build: {
outDir: 'dist/main'
}
}
})
}

return {
define: {
VUE_I18N_FULL_INSTALL: true,
VUE_I18N_LEGACY_API: false,
INTLIFY_PROD_DEVTOOLS: false
},
resolve: {
extensions: ['.mjs', '.js', '.ts', '.vue', '.json', '.scss'],
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
base: './',
root: resolve('./src/renderer'),
publicDir: resolve('./src/renderer/public'),
clearScreen: false,
build: {
sourcemap: isDevEnv,
minify: !isDevEnv,
outDir: resolve('./dist')
},
plugins: [
Vue(),
VueJsx(),
// Docs: https://github.com/vuetifyjs/vuetify-loader
VuetifyPlugin({
autoImport: true
}),
// EslintPlugin(),
// Docs: https://github.com/electron-vite/vite-plugin-electron
ElectronPlugin(electronPluginConfigs),
RendererPlugin()
]
}
})

Update vite-plugin-electron to 0.15.4

Describe the bug
The version of vite-plugin-electron this repo uses by default has a bug where it leaves electron renderers running every time a main/* file is updated and the main app process is restarted

To Reproduce
Update any file in src/main/* and use procexp to monitor for stray electron processes at the bottom

Expected behavior
All electron renderers close successfully

Device information (please complete the following information):

  • OS Name: Windows
  • OS Version: Win 11

Screenshots & Attachments
N/A

Additional context
Wasn't able to fix this myself (npm run dev just fails silently after the update for unknown reasons)
tree-kill needs to be installed as a dev dep to fix this as well

Sent events in Preload Script

Not sure if this is a bug, this could easily me be me not understanding enough of electron.
I try to sent messages from the pre load script to the render.

I tried stuff like:

//option 1
ipcMain.emit('eventName', param1, param2)
//option 2
window.mainApi.send('eventName', param1, param2)
//option 3
ipcRenderer.send('eventName', param1, param2)

But somehow it doesn't get picked-up in the vue side.
Where I subscribed like:

window.mainApi.on('eventName', handleEvent)

Could you add some examples to the documentation how to achieve this?

How to inject preload in right way?

When I set preload value to DEFAULT_WEB_PREFERENCES prop, the client console show error message: electron preload Cannot use import statement outside a module. I resume that the vite could not compile the preload.js file to es2015 syntax in dist/main folder? Please give a example to this scene, thanks.

VSCode launch configurations

This combination is everything I wanted. But I'm having trouble creating a VSCode launch.json that allows debugging both the main and the renderer processes. With that it would be complete...

The CJS build of Vite's Node API is deprecated.

Hello,

The CJS build of Vite's Node API is deprecated.

Can you change the filename
vite.config.ts
to
vite.config.mts?

Even the include in tsconfig.node.json row 12:
"include": ["src/main", "src/preload", "package.json", "vite.config.ts", "buildAssets/builder"]
to
"include": ["src/main", "src/preload", "package.json", "vite.config.mts", "buildAssets/builder"]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.