diff --git a/README.md b/README.md index 52b5445..e16a5e1 100644 --- a/README.md +++ b/README.md @@ -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` diff --git a/package.json b/package.json index 5a01035..7a9b6e9 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/plugin.ts b/src/plugin.ts index d794cd1..b7fb65d 100644 --- a/src/plugin.ts +++ b/src/plugin.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}`])]