{"id":17978722,"url":"https://github.com/xland/vitetron","last_synced_at":"2026-05-09T09:55:06.982Z","repository":{"id":57393268,"uuid":"287856691","full_name":"xland/vitetron","owner":"xland","description":"Develop and build electron project with vite and vue3","archived":false,"fork":false,"pushed_at":"2020-10-15T03:59:01.000Z","size":138,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T01:09:35.349Z","etag":null,"topics":["electron","vite","vue3"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xland.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-16T02:06:51.000Z","updated_at":"2022-09-29T08:41:51.000Z","dependencies_parsed_at":"2022-08-27T11:11:35.415Z","dependency_job_id":null,"html_url":"https://github.com/xland/vitetron","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xland%2Fvitetron","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xland%2Fvitetron/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xland%2Fvitetron/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xland%2Fvitetron/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xland","download_url":"https://codeload.github.com/xland/vitetron/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247099860,"owners_count":20883477,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["electron","vite","vue3"],"created_at":"2024-10-29T17:34:55.051Z","updated_at":"2026-05-09T09:55:01.945Z","avatar_url":"https://github.com/xland.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vitetron\n\nDevelop and build electron project with vite and vue3\n\n## Install\n\n```bash\n$ yarn create vite-app project-name\n$ cd project-name\n$ yarn add vitetron --dev\n$ yarn add electron --dev\n$ yarn add electron-builder --dev\n$ yarn add esbuild --dev\n```\n\nAdd `background.ts` at the ./src folder\n\nSet the file's content with:\n\n```js\nimport { app, BrowserWindow } from \"electron\";\nlet win;\napp.on(\"ready\", () =\u003e {\n  win = new BrowserWindow();\n  vitetron.load(win, \"index.html\"); //vitetron will be injected automaticly.\n});\n```\n\nadd scripts to your package.json\n\n```json\n  \"scripts\": {\n    \"start\": \"vitetron start\",\n    \"release\": \"vitetron release\"\n  }\n```\n\nrun `yarn start` to develope,`yarn release` for build\n\n## Config\n\nAdd `vitetron.config.js` at the root of the project\n\nSet the file's content with\n\n```js\nmodule.exports = {\n  main: \"./src/background.ts\",\n  build: {\n    appId: \"com.xland.app\",\n    productName: \"ViteElectron示例\",\n  },\n  env: {\n    dev: {\n      SERVICE_BASE_URL: \"https://dev.yourdomain.site\",\n    },\n    test: {\n      SERVICE_BASE_URL: \"https://test.yourdomain.site\",\n    },\n    release: {\n      SERVICE_BASE_URL: \"https://release.yourdomain.site\",\n    },\n  },\n};\n```\n\n### main\n\nThe entry file of the main process,`.js` and `.ts` file are supported\n\n### build\n\nThe [electron-builder's config](https://www.electron.build/configuration/configuration)\n\nDo not set `directories` for the config\n\n### env\n\nThe customized definition of `process.env`\n\n## todo：\n\n主进程可以调试\n\nvitetron 有 TS 的类型\n\nvue-cli 移除了哪些依赖\n\n测试一下包含外部引用的主进程入口程序\n\n默认支持.js 和.ts 的入口文件\n\n尽量把需要的库都给它装好\n\n自动创建 script 命令\n\ntest on mac\n\n启动时传递额外的参数给 electron\n\n注入的脚本，怎么编译\n\n把 win.loadURL shake 掉一个分支\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxland%2Fvitetron","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxland%2Fvitetron","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxland%2Fvitetron/lists"}