From d7c0a9194a4590116060fee80eb64e98ee32b432 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8D=89=E9=9E=8B=E6=B2=A1=E5=8F=B7?= <308487730@qq.com> Date: Fri, 5 Jan 2024 23:20:18 +0800 Subject: [PATCH 1/2] feat: preload built `format` adapt to `esm` --- src/simple.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/simple.ts b/src/simple.ts index c126083..cef485e 100644 --- a/src/simple.ts +++ b/src/simple.ts @@ -53,7 +53,7 @@ export default async function electronSimple(options: ElectronSimpleOptions): Pr output: { // For use the Electron API - `import { contextBridge, ipcRenderer } from 'electron'`, // Note, however, that `preload.ts` should not be split. 🚧 - format: 'cjs', + format: esmodule ? 'esm' : 'cjs', // Whether Node.js is enabled in the Main process or not, the Preload scripts supports loading `electron` module, // so we need to build it in `cjs` format. From 3d96c5ffeb2586e341381160ac5af1bbdd11bfed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8D=89=E9=9E=8B=E6=B2=A1=E5=8F=B7?= <308487730@qq.com> Date: Fri, 5 Jan 2024 23:21:42 +0800 Subject: [PATCH 2/2] v0.28.0-beta.3 --- CHANGELOG.md | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f202bec..05e9a3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.28.0-beta.3 (2024-01-05) + +- d7c0a91 feat: preload built `format` adapt to `esm` + ## 0.28.0-beta.2 (2024-01-02) - f557a98 feat: supports `"type": "module"`, better `esm` logic diff --git a/package.json b/package.json index b2a1659..163a82d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vite-plugin-electron", - "version": "0.28.0-beta.2", + "version": "0.28.0-beta.3", "description": "Electron 🔗 Vite", "main": "./dist/index.js", "types": "./dist/index.d.ts",