Skip to content

Commit 45f28bb

Browse files
committed
chore: update CHANGELOG
1 parent f9b81e4 commit 45f28bb

File tree

1 file changed

+72
-3
lines changed

1 file changed

+72
-3
lines changed

CHANGELOG.md

Lines changed: 72 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,75 @@
22

33
- 20170a5 refactor: preload built `format` use `esm` by default
44

5+
#### Migration to v0.28.0
6+
7+
- **No break changes**. Just need to define `"type": "module"` in package.json for supports `esm` :)
8+
- **By the way**. Recommend using the `vite-plugin-electron/simple` API. It is simpler, and the main difference is its adaptation to `preload` scripts.
9+
- **electron@28** Preload scripts [👉 limitations](https://github.com/electron/electron/blob/v30.0.0-nightly.20240104/docs/tutorial/esm.md#preload-scripts).
10+
11+
#### Preload scripts
12+
13+
In most cases, use `cjs` format
14+
15+
```log
16+
`require()` can usable matrix
17+
18+
@see - https://github.com/electron/electron/blob/v30.0.0-nightly.20240104/docs/tutorial/esm.md#preload-scripts
19+
┏———————————————————————————————————┳——————————┳———————————┓
20+
│ webPreferences: { } │ import │ require │
21+
┠———————————————————————————————————╂——————————╂———————————┨
22+
│ nodeIntegration: false(undefined) │ ✘ │ ✔ │
23+
┠———————————————————————————————————╂——————————╂———————————┨
24+
│ nodeIntegration: true │ ✔ │ ✔ │
25+
┠———————————————————————————————————╂——————————╂———————————┨
26+
│ sandbox: true(undefined) │ ✘ │ ✔ │
27+
┠———————————————————————————————————╂——————————╂———————————┨
28+
│ sandbox: false │ ✔ │ ✘ │
29+
┠———————————————————————————————————╂——————————╂———————————┨
30+
│ nodeIntegration: false │ ✘ │ ✔ │
31+
│ sandbox: true │ │ │
32+
┠———————————————————————————————————╂——————————╂———————————┨
33+
│ nodeIntegration: false │ ✔ │ ✘ │
34+
│ sandbox: false │ │ │
35+
┠———————————————————————————————————╂——————————╂———————————┨
36+
│ nodeIntegration: true │ ✘ │ ✔ │
37+
│ sandbox: true │ │ │
38+
┠———————————————————————————————————╂——————————╂———————————┨
39+
│ nodeIntegration: true │ ✔ │ ✔ │
40+
│ sandbox: false │ │ │
41+
┗———————————————————————————————————┸——————————┸———————————┛
42+
- import(✘): SyntaxError: Cannot use import statement outside a module
43+
- require(✘): ReferenceError: require is not defined in ES module scope, you can use import instead
44+
```
45+
46+
#### Built format
47+
48+
This is just the default behavior, and you can modify them at any time through custom config in the `vite.config.js`
49+
50+
```log
51+
{ "type": "module" }
52+
┏————————————————————┳——————————┳———————————┓
53+
│ built │ format │ suffix │
54+
┠————————————————————╂——————————╂———————————┨
55+
│ main process │ esm │ .js │
56+
┠————————————————————╂——————————╂———————————┨
57+
│ preload scripts │ cjs │ .mjs │ diff
58+
┠————————————————————╂——————————╂———————————┨
59+
│ renderer process │ - │ .js │
60+
┗————————————————————┸——————————┸———————————┛
61+
62+
{ "type": "commonjs" } - default
63+
┏————————————————————┳——————————┳———————————┓
64+
│ built │ format │ suffix │
65+
┠————————————————————╂——————————╂———————————┨
66+
│ main process │ cjs │ .js │
67+
┠————————————————————╂——————————╂———————————┨
68+
│ preload scripts │ cjs │ .js │ diff
69+
┠————————————————————╂——————————╂———————————┨
70+
│ renderer process │ - │ .js │
71+
┗————————————————————┸——————————┸———————————┛
72+
```
73+
574
## 0.28.0-beta.3 (2024-01-05)
675

776
- d7c0a91 feat: preload built `format` adapt to `esm`
@@ -12,9 +81,9 @@
1281

1382
#### Migration to v0.28.0-beta.2
1483

15-
- **No break changes**. Just need to define `"type": "module"` in package.json for supports `esm` :)
16-
- **By the way**. Recommend using the `vite-plugin-electron/simple` API. It is simpler, and the main difference is its adaptation to `preload` scripts.
17-
- **electron@28** Preload scripts [👉 limitations](https://github.com/electron/electron/blob/v30.0.0-nightly.20231218/docs/tutorial/esm.md#preload-scripts).
84+
- ~~**No break changes**. Just need to define `"type": "module"` in package.json for supports `esm` :)~~
85+
- ~~**By the way**. Recommend using the `vite-plugin-electron/simple` API. It is simpler, and the main difference is its adaptation to `preload` scripts.~~
86+
- ~~**electron@28** Preload scripts [👉 limitations](https://github.com/electron/electron/blob/v30.0.0-nightly.20231218/docs/tutorial/esm.md#preload-scripts).~~
1887

1988
## 0.28.0-beta.1 (2023-12-30)
2089

0 commit comments

Comments
 (0)