perf: no need to polyfill module preload for the Electron renderer
This commit is contained in:
parent
ef99b02b18
commit
82477b6db2
|
@ -73,10 +73,10 @@ function createWindow() {
|
|||
| ├──preload
|
||||
| | ├──index.js
|
||||
| | └──...
|
||||
| ├──renderer
|
||||
| | ├──src
|
||||
| | ├──index.html
|
||||
| | └──...
|
||||
| └──renderer
|
||||
| ├──src
|
||||
| ├──index.html
|
||||
| └──...
|
||||
├──electron.vite.config.js
|
||||
└──package.json
|
||||
```
|
||||
|
@ -178,6 +178,7 @@ See [vitejs.dev](https://vitejs.dev/config)
|
|||
- **outDir**: `out\renderer`(relative to project root)
|
||||
- **target**: `chrome*`, automatically match chrome target of `Electron`. For example, the chrome target of Electron 17 is `chrome98`
|
||||
- **lib.entry**: `src\renderer\index.html`(relative to project root), empty string if not found
|
||||
- **polyfillModulePreload**: `false`, there is no need to polyfill `Module Preload` for the Electron renderer
|
||||
- **rollupOptions.external**: the same as `main`
|
||||
|
||||
#### Define option for `main` and `preload`
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "electron-vite",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "Use vite for your electron app.",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
|
|
@ -226,6 +226,7 @@ export function electronRendererVitePlugin(options?: ElectronPluginOptions): Plu
|
|||
build: {
|
||||
outDir: path.resolve(root, 'out', 'renderer'),
|
||||
target: chromeTarget,
|
||||
polyfillModulePreload: false,
|
||||
rollupOptions: {
|
||||
input: findInput(root),
|
||||
external: [...builtinModules.flatMap(m => [m, `node:${m}`])]
|
||||
|
|
Loading…
Reference in a new issue