Closed johnheroy closed 2 years ago
同问,刚前几天问了alias的问题,发现这是两个不同的插件
先定个前提,用 esbuild 的 transform 部分,而不是 build 部分。
个人倾向于 transform 方案,esbuild、swc 这种都是极快的。热重启速度不受项目大小影响 用 Vite 构建主进程只能使用 vite build 功能,但是 build 使用的是 bundle 方案(基于Rollup)。打包速度随着页面增加越来越慢。
esbuild 优势
Vite 优点
+1 , it's very confusing to have both vite-electron-plugin and vite-plugin-electron
Using DeepL and some touch ups:
The vite-electron-plugin
design principle is consistent with tsc
! i.e. input as many files as you want and output as many files as you want
esbuild
tsc
-like behavior means no-bundling, which is very important and consistent with Vite's no-bundling philosophy, therefore it's very fast
vite-plugin-electron
uses Vite to build all code, main process, Preload-Scripts
vite-plugin-electron-renderer
provides two features
Let's start with the premise that the transform option of esbuild
is used instead of the build option
Personally, I prefer the transform option. esbuild
and swc
are both extremely fast
Hot reloading speed is not affected by the project's size
The main process of building with Vite can only use Vite's build feature, but building uses the bundle scheme (based on Rollup) The build speed gets slower and slower as the project's size increases
esbuild
Pros
Cons
Vite Pros
esbuild
Cons
esbuild
As title - what are the differences between these two vite plugins for electron?