⚡️Starter template with Vite2 Vue3 and Electron 11.x /使用 Vite2 Vue3 以及 Electron 11.x 打造的快速启动模版。

Overview

vite-electron-quick

👻 A fast Simple Vite2 Vue3 and Electron 11.x template.

⚡️ If you want to fast create a Vite 2 + Vue 3 + Electron 11.x project:

🚀 Why not use this?

quick install


npx create-vite-electron <project_name>

yarn create vite-electron <project_name>

run

  • yarn

  • yarn dev

  • yarn build

change log

210219

  • resolve #6
  • change vite config file (alias => resolve.alias)
  • current version:
    • vite 2.0.1
    • electron 11.2.3

210113

  • fix Vite2 config bugs
  • vue-router next use hash mode instead of history mode

210108

  • use Vite2
  • use Electron 11.x

201029

  • fix build bug
  • if build slowly, you can use electron mirror

201026

  • vite update, update vite.config.ts file
  • add third lib element-plus import globally
  • please note when using NODE MODULE, may need to change vite.config.ts -> optimizeDeps.allowNodeBuiltins

原因

  • vite 的快速发展以及更新,让其他能与之配合的项目各显神通,为什么不来试一试呢?
  • vite 处于 beta 状态,目前还没有适合的脚手架与 electron 11.x 版本搭配使用
  • 业务上原本使用的 electron-vue 框架,由于使用的 electron 以及 webpack 版本较低,升级很麻烦。于是计划使用新的方案探索可能性。
  • 使用 electron 的业务,是为数不多可以不考虑兼容性的业务,能够在业务中使用最新的框架是不可多得的机会。

使用 3rd lib tips

  • 第三方库都可能会与 vite 以及 electron 框架本身造成冲突,请谨慎选择。
Comments
  • 升级最新依赖出错

    升级最新依赖出错

    升级到最新依赖 然后dev 报错 [vue] (!) "build.base" config option is deprecated. "base" is now a root-level config option. [vue] (!) invalid "base" option: .. The value can only be an absolute URL, ./, or an empty string. 大佬有空看下不 谢谢

    opened by yigehaobb 9
  • 打包出来有问题

    打包出来有问题

    Not allowed to load local resource: file:///C:/Users/Bo/Desktop/vite-electron-quick-master/vite-electron-quick-master/dist/win-unpacked/resources/app.asar/dist/render/index.html 之前vite1 打包出来没问题

    opened by yigehaobb 6
  • .vue with ts

    .vue with ts

    原文件书写方式在 volar 下存在警告,可能是由于 js 和 tsconfig.json 的模式不兼容。 可以在 tsconfig.json 中添加 allowJS: true 解决,但是既然都选择 ts 了,为什么不全部用 ts 来编写呢?

    image

    • 将 .vue 文件修改为 <script lang="ts"> 方式
    opened by orziz 5
  • require is not defined

    require is not defined

    我这里也用vite 和 vue + electron 搭了套环境

    在vue组件中 希望点击事件 触发ipcRender.send

    <script setup>
    import TopBar from '@/components/layout/TopBar.vue'
    import electron from 'electron' //  __dirname is not defined
    const electron = require('electron') // require is not defined
    
    </script>
    

    nodeIntegration:true 开启了

    这个Bug 困扰了我两天了。。

    opened by HomyeeKing 3
  • Fix Vite version

    Fix Vite version

    I just tried to clone and run the project and encountered an error:

    npm ERR! notarget No matching version found for vite@^1.0.0.
    

    To fix this, I suggest updating the Vite version

    opened by cawa-93 3
  • 不能运行 dev

    不能运行 dev

    PS F:\stereo-camera> npm run dev
    
    > [email protected] dev
    > npm run dev:all
    
    
    > [email protected] dev:all
    > concurrently -n=vue,ele -c=green,blue "npm run dev:vue" "npm run dev:ele"
    
    [vue] 
    [vue] > [email protected] dev:vue
    [vue] > vite
    [vue]
    [ele] 
    [ele] > [email protected] dev:ele
    [ele] > node script/build --env=development --watch
    [ele]
    [vue] events.js:292
    [vue]       throw er; // Unhandled 'error' event
    [vue]       ^
    [vue]
    [vue] Error: spawn F:\stereo-camera\node_modules\esbuild\esbuild.exe ENOENT
    [vue]     at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
    [vue]     at onErrorNT (internal/child_process.js:465:16)
    [vue]     at processTicksAndRejections (internal/process/task_queues.js:80:21)
    [vue] Emitted 'error' event on ChildProcess instance at:
    [vue]     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
    [vue]     at onErrorNT (internal/child_process.js:465:16)
    [vue]     at processTicksAndRejections (internal/process/task_queues.js:80:21) {
    [vue]   errno: -4058,
    [vue]   code: 'ENOENT',
    [vue]   syscall: 'spawn F:\\stereo-camera\\node_modules\\esbuild\\esbuild.exe',
    [vue]   path: 'F:\\stereo-camera\\node_modules\\esbuild\\esbuild.exe',
    [vue]   spawnargs: [ '--service=0.9.4', '--ping' ]
    [vue] }
    [vue] npm ERR! code 1
    [vue] npm ERR! path F:\stereo-camera
    [vue] npm ERR! command failed
    [vue] npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c vite
    [vue] 
    [vue] npm ERR! A complete log of this run can be found in:
    [vue] npm ERR!     C:\Users\Cery\AppData\Local\npm-cache\_logs\2021-03-19T15_33_00_423Z-debug.log
    [vue] npm run dev:vue exited with code 1
    [ele] Error: Timed out waiting for: http://localhost:8889/index.html
    [ele]     at MergeMapSubscriber.project (F:\stereo-camera\node_modules\wait-on\lib\wait-on.js:132:31)
    [ele]     at MergeMapSubscriber._tryNext (F:\stereo-camera\node_modules\rxjs\internal\operators\mergeMap.js:67:27)
    [ele]     at MergeMapSubscriber._next (F:\stereo-camera\node_modules\rxjs\internal\operators\mergeMap.js:57:18)
    [ele]     at MergeMapSubscriber.Subscriber.next (F:\stereo-camera\node_modules\rxjs\internal\Subscriber.js:66:18)
    [ele]     at AsyncAction.dispatch (F:\stereo-camera\node_modules\rxjs\internal\observable\timer.js:31:16)
    [ele]     at AsyncAction._execute (F:\stereo-camera\node_modules\rxjs\internal\scheduler\AsyncAction.js:71:18)
    [ele]     at AsyncAction.execute (F:\stereo-camera\node_modules\rxjs\internal\scheduler\AsyncAction.js:59:26)
    [ele]     at AsyncScheduler.flush (F:\stereo-camera\node_modules\rxjs\internal\scheduler\AsyncScheduler.js:52:32)
    [ele]     at listOnTimeout (internal/timers.js:554:17)
    [ele]     at processTimers (internal/timers.js:497:7)
    [ele] npm ERR! code 1
    [ele] npm ERR! path F:\stereo-camera
    [ele] npm ERR! command failed
    [ele] npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node script/build --env=development --watch
    [ele] 
    [ele] npm ERR! A complete log of this run can be found in:
    [ele] npm ERR!     C:\Users\Cery\AppData\Local\npm-cache\_logs\2021-03-19T15_33_05_739Z-debug.log
    [ele] npm run dev:ele exited with code 1
    npm ERR! code 1
    npm ERR! path F:\stereo-camera
    npm ERR! command failed
    npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c concurrently -n=vue,ele -c=green,blue "npm run dev:vue" "npm run dev:ele"
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     C:\Users\Cery\AppData\Local\npm-cache\_logs\2021-03-19T15_33_05_819Z-debug.log
    npm ERR! code 1
    npm ERR! path F:\stereo-camera
    npm ERR! command failed
    npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c npm run dev:all
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     C:\Users\Cery\AppData\Local\npm-cache\_logs\2021-03-19T15_33_05_870Z-debug.log
    

    下面是log ,求助 !

    0 verbose cli [
    0 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
    0 verbose cli   'C:\\Users\\Cery\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
    0 verbose cli   'run',
    0 verbose cli   'dev:vue'
    0 verbose cli ]
    1 info using [email protected]
    2 info using [email protected]
    3 timing config:load:defaults Completed in 2ms
    4 timing config:load:file:C:\Users\Cery\AppData\Roaming\npm\node_modules\npm\npmrc Completed in 1ms
    5 timing config:load:builtin Completed in 1ms
    6 timing config:load:cli Completed in 2ms
    7 timing config:load:env Completed in 1ms
    8 timing config:load:file:F:\stereo-camera\.npmrc Completed in 0ms
    9 timing config:load:project Completed in 1ms
    10 timing config:load:file:F:\cadence_workspace\.npmrc Completed in 0ms
    11 timing config:load:user Completed in 0ms
    12 timing config:load:file:C:\Users\Cery\AppData\Roaming\npm\etc\npmrc Completed in 1ms
    13 timing config:load:global Completed in 1ms
    14 timing config:load:cafile Completed in 0ms
    15 timing config:load:validate Completed in 2ms
    16 timing config:load:setUserAgent Completed in 0ms
    17 timing config:load:setEnvs Completed in 1ms
    18 timing config:load Completed in 11ms
    19 verbose npm-session f9712d0d074830cd
    20 timing npm:load Completed in 19ms
    21 timing command:run Completed in 297ms
    22 verbose stack Error: command failed
    22 verbose stack     at ChildProcess.<anonymous> (C:\Users\Cery\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\promise-spawn\index.js:64:27)
    22 verbose stack     at ChildProcess.emit (events.js:315:20)
    22 verbose stack     at maybeClose (internal/child_process.js:1048:16)
    22 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
    23 verbose pkgid [email protected]
    24 verbose cwd F:\stereo-camera
    25 verbose Windows_NT 10.0.19041
    26 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Cery\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev:vue"
    27 verbose node v14.16.0
    28 verbose npm  v7.6.3
    29 error code 1
    30 error path F:\stereo-camera
    31 error command failed
    32 error command C:\WINDOWS\system32\cmd.exe /d /s /c vite
    33 verbose exit 1
    
    
    opened by JsBlueCat 2
  • A JavaScript error occurred in the main process

    A JavaScript error occurred in the main process

    [vue] error when starting dev server: [vue] Error: The following dependencies are imported but could not be resolved: [vue] element-plus/lib/theme-chalk/index.css (imported by /home/golove/vite_electron/src/render/main.ts) [vue] Are they installed?

    ele] A JavaScript error occurred in the main process [ele] Uncaught Exception: [ele] TypeError: Cannot destructure property 'ANY' of 'require$$26' as it is undefined.

    opened by golove 2
  • Missing components and assets

    Missing components and assets

    An update of rollup-build-plugin has just been launched and I had to update it manually because some methods are not supported by esbuild anymore and the version that comes in the preset does not work.

    I had my app running with vite 1 with an old preset of vite-electron-quick and when I reinstalled the node_modules there were all kinds of problems, but I solved it by installing and adapting my code with a new npx create-vite-electron, up to this point everything is fine, dev mode works and when I build everything seems fine... but actually the app does not load some assets and components even when they exist in the unpacked directory.

    These are the files that my app is triying to load in: imagen

    These are the failed and successful requests: imagen

    I have realized that the routes that fail are all relative and those that load are absolute:

    Failing: file:///assets/duration.c3d062a9.js Loading:file:///C:/Users/denyncrawford/Documents/proyectos/guillotine/dist/win-unpacked/resources/app/dist/render/assets/Auth.9a0064a5.js

    Finally, here are some of my built assets and they are not even half, which are not being loaded in the view: imagen

    This is wat I get when I try to push a route that is not being loaded:

    image

    I think it has something to do with esbuild or @vue/compiler-rfc but I don't think it is this last one because I was using the same version before.

    Versions:

    rollup-plugin-esbuild: 3.0.0 vite: latest @vue/compiler-sfc: 3.0.7 vue: 3.0.7 electron: ^11.0.0

    opened by denyncrawford 0
Owner
qicoo
FE
qicoo
Vite Vant Template 是一个免费开源的移动端模版。使用了最新的`vue3`,`vite2`等主流技术开发,开箱即用的移动端解决方案

简介 Vite Vant Template 是一个免费开源的移动端模版。使用了最新的vue3,vite2等主流技术开发,开箱即用的移动端解决方案,也可用于学习参考。 特性 最新技术栈:使用 Vue3/vite2 等前端前沿技术开发 Mock 数据 内置 Mock 数据方案 预览 没有梯子的可移步码云

null 23 Dec 8, 2022
✨ ✨ ✨ A vue3 style Admin based on Vite2, vue3.0, ant-design-vue 2.x, typescript,vuex,vue-router,Efforts to update in progress...

VUE VBEN ADMIN2.0 Chinese | English CHANGELOG Introduction GitHub Thin Preview Documentation Preinstallation Environmental requirements UI framework I

Vben 15.6k Jan 7, 2023
👻 A fast Simple Vite 2, Vue 3 and Electron 13.x template.

?? A fast Simple Vite 2, popular front-end frameworks and Electron 13.x template. This template should help get you started developing with Vite 2, popular front-end frameworks and Typescript in Electron.

Albert Channel Sky 61 Jan 8, 2023
Vite - Vue 2 starter template using composition-api and windiCSS

Vite ⚡ - Vue 2 starter template Create a Vue 2 application bundled by the lightning fast build tool Vite ✨ Live Demo ?? Features ⚡️ Vite 2, Vue 2 and

null 173 Dec 30, 2022
Starter template for Neutralino.js with Vite.js and Vue.js

Neutralino.js Template With Vite.js and Vue.js Neutralino.js Neutralino.js is a new competitor to Electron.js which is smaller and consumes tiny amoun

YoonesKh 46 Dec 6, 2022
🏕 Opinionated Vite Starter Template

Mocking up web app with Vitesse(speed) Now with Windi CSS! ⚡️ Live Demo Features ⚡️ Vue 3, Vite 2, pnpm, ESBuild - born with fastness ?? File based ro

Anthony Fu 6.6k Jan 4, 2023
Opinionated Vite starter template with TailwindCSS for building admin dashboard

Opinionated Vite starter template with TailwindCSS

Christopher Reeve 110 Jan 2, 2023
A Tailwind CSS starter template for Vite

Vite + Tailwind CSS Starter A Tailwind CSS starter template for Vite Tailwind UI Users If you have access to Tailwind UI, follow these steps to add it

Eduardo San Martin Morote 419 Dec 27, 2022
Vue 3 boilerplate starter based on Vite and Tailwindcss 2

vite-wind WIP ?? ?? ?? It's a Vue 3 boilerplate based on Tailwindcss + Typescript + Vite + css-pro-layout, You could clone this repository and use the

Brahim 86 Dec 20, 2022
Resume generation template - Power by Vue3 + Vite + tailwindcss

简历生成模板 Vue3 + Vite + tailwindcss 功能 Web 端显示简历 打印成 PDF 通过 JSON 配置简历内容 使用方法 点击页面右上角的修改数据按钮,会弹出用于修改数据的文本框。 根据以下示例数据修改后点击弹出框的保存。

null 4 Aug 17, 2021
Electron app boilerplate based on Vite 2.0

Vite Electron Builder Template Vite+Electron = ?? This is a secure template for electron applications. Written following the latest safety requirement

Alex Kozack 1.5k Jan 7, 2023
Vite 2.x + Vue 3.x + Tailwind 2.x (starter) ⚡

Vite 2.x + Vue 3.x + Tailwind 2.x starter ⚡ This starter template also includes: Vue Router 4.x Inter var font (self-hosted, woff2 format, version 3.1

Eugene Kopich 1k Oct 5, 2022
Opinionated Vite + Vue 3 + TypeScript + Tailwind CSS starter.

Vite Typescript + Tailwind Starter Simple, opinionated, and production-ready TS + Tailwind project template for Vite 2. See changelog for latest chang

Ville Säävuori 284 Jan 8, 2023
A starter kit for vue-cesium with Vite

element-plus-vite-starter A starter kit for vue-cesium generated by vue-cli This template should help get you started developing with Vue 3 and Typesc

zouyaoji 15 Oct 16, 2022
Vite-starter - Vueform Vite + TailwindCSS 3 Boilerplate

Vueform Vite + TailwindCSS 3 Boilerplate Last tested with Vite 2.7.13. Installat

Vueform 4 Feb 8, 2022
This template should help get you started developing with Vue 3 and Typescript in Vite.

Underscore_ Voici la homepage du podcast ! Vue 3 + Typescript + Vite This template should help get you started developing with Vue 3 and Typescript in

Micode 20 Oct 28, 2022
A Vue.js template with built-in Vite, Sass, TypeScript, PostCSS, and Tailwind CSS to help you start your project!

Vue 3 + Typescript + Vite This template should help get you started developing with Vue 3 and Typescript in Vite. The template uses Vue 3 <script setu

LouieMartin 3 Jul 7, 2022
Emp-portal-vite - A template with Vue Router, VueX, TailwindCss and JIT Compiler

Vite + Vue + VueX + Vue Router + TailwindCss + JIT This template allows you to q

Rajiv Perera 1 Jan 29, 2022
Extended version of vite's official vue-ts template. adds CI, linting, testing and auto-formatting.

vite-vue-ts-template extended version of vite's official vue-ts template. additional features: eslint for linting. vitest + testing-library for testin

Felix Spöttel 1 Jun 1, 2022