Compare commits

...

13 Commits

Author SHA1 Message Date
Fynn Haupt
d12b7dc0da
Merge e5a4ff6c4e4fcff0315a7ae5ae186ff44e1165bc into 1eeb15ea770eb7595d1bee3013211f41d2b4104b 2025-07-07 11:09:03 +08:00
alex8088
1eeb15ea77 release: v4.0.0 2025-07-06 23:12:09 +08:00
alex8088
52abc48abf release: v4.0.0-beta.0 2025-06-28 13:29:56 +08:00
alex8088
cbee52c8bb perf: build compatibility target for Electron 37 2025-06-28 13:12:31 +08:00
alex8088
48e6f4f570 fix(deps)!: update Vite to v7 and remove cjs build 2025-06-28 13:08:38 +08:00
alex8088
4071778f07 fix: use import type for type-only imports 2025-06-28 00:01:48 +08:00
alex8088
3fd16d0c23 refactor!: bump required node version to 20.19+, 22.12+ 2025-06-27 23:10:23 +08:00
alex8088
d2e8b1271b chore: allow breaking commit message 2025-06-27 23:07:33 +08:00
alex8088
28d7df6e91 chore(deps): update lint-staged to v16 2025-06-27 22:02:26 +08:00
alex8088
b7763a7f77 chore(deps): update all non-major dependencies 2025-06-27 21:59:22 +08:00
alex8088
1c084cc090 chore(deps): update pnpm to v10 2025-06-27 21:50:18 +08:00
Fynn Haupt
e5a4ff6c4e fix that build script doesn't end after building 2024-04-04 01:44:38 +02:00
Fynn Haupt
f33f67c147 use config.base also in production 2024-04-03 22:29:44 +02:00
14 changed files with 1812 additions and 1548 deletions

View File

@ -1,3 +1,18 @@
### v4.0.0 (_2025-07-06_)
- refactor!: bump required node version to 20.19+, 22.12+
- fix(deps)!: update Vite to v7 and remove cjs build
- fix: use `import type` for type-only imports
- perf: build compatibility target for Electron 36 ([#766](https://github.com/alex8088/electron-vite/pull/766))
- perf: build compatibility target for Electron 37
- chore(deps): update pnpm to v10
- chore(deps): update all non-major dependencies
- chore(deps): update lint-staged to v16
### v4.0.0-beta.0 (_2025-06-28_)
See [v4.0.0-beta.0 changelog](https://github.com/alex8088/electron-vite/blob/v4.0.0-beta.0/CHANGELOG.md)
### v3.1.0 (_2025-03-25_)
- fix(bytecodePlugin): optimize 'use strict' directive replacement ([#681](https://github.com/alex8088/electron-vite/issues/681))

View File

@ -24,7 +24,7 @@ if (debugIndex > 0) {
}
function run() {
import('../dist/cli.mjs')
import('../dist/cli.js')
}
run()

View File

@ -22,6 +22,11 @@ export default tseslint.config(
...globals.node
}
},
settings: {
node: {
version: '^20.19.0 || >=22.12.0'
}
},
rules: {
'prettier/prettier': 'warn',
'@typescript-eslint/ban-ts-comment': ['error', { 'ts-ignore': 'allow-with-description' }],

View File

@ -1,17 +1,12 @@
{
"name": "electron-vite",
"version": "3.1.0",
"version": "4.0.0",
"description": "Electron build tooling based on Vite",
"type": "module",
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
},
".": "./dist/index.js",
"./node": {
"types": "./node.d.ts"
},
@ -26,9 +21,9 @@
"node.d.ts"
],
"engines": {
"node": "^18.0.0 || >=20.0.0"
"node": "^20.19.0 || >=22.12.0"
},
"packageManager": "pnpm@8.6.10",
"packageManager": "pnpm@10.12.4",
"author": "Alex Wei<https://github.com/alex8088>",
"license": "MIT",
"repository": {
@ -66,7 +61,7 @@
},
"peerDependencies": {
"@swc/core": "^1.0.0",
"vite": "^4.0.0 || ^5.0.0 || ^6.0.0"
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0"
},
"peerDependenciesMeta": {
"@swc/core": {
@ -74,33 +69,40 @@
}
},
"devDependencies": {
"@eslint/js": "^9.22.0",
"@eslint/js": "^9.29.0",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^16.0.1",
"@rollup/plugin-typescript": "^12.1.2",
"@swc/core": "^1.11.9",
"@types/node": "^22.13.10",
"eslint": "^9.22.0",
"eslint-config-prettier": "^10.1.1",
"eslint-plugin-prettier": "^5.2.3",
"globals": "^16.0.0",
"lint-staged": "^15.4.3",
"prettier": "^3.5.3",
"rollup": "^4.35.0",
"rollup-plugin-dts": "^6.1.1",
"@rollup/plugin-typescript": "^12.1.3",
"@swc/core": "^1.12.7",
"@types/node": "^22.15.33",
"eslint": "^9.29.0",
"eslint-config-prettier": "^10.1.5",
"eslint-plugin-prettier": "^5.5.1",
"globals": "^16.2.0",
"lint-staged": "^16.1.2",
"prettier": "^3.6.2",
"rollup": "^4.44.1",
"rollup-plugin-dts": "^6.2.1",
"rollup-plugin-rm": "^1.0.2",
"simple-git-hooks": "^2.11.1",
"simple-git-hooks": "^2.13.0",
"tslib": "^2.8.1",
"typescript": "^5.7.3",
"typescript-eslint": "^8.26.1",
"vite": "^6.2.1"
"typescript": "^5.8.3",
"typescript-eslint": "^8.35.0",
"vite": "^7.0.0"
},
"dependencies": {
"@babel/core": "^7.26.10",
"@babel/plugin-transform-arrow-functions": "^7.25.9",
"@babel/core": "^7.27.7",
"@babel/plugin-transform-arrow-functions": "^7.27.1",
"cac": "^6.7.14",
"esbuild": "^0.25.1",
"esbuild": "^0.25.5",
"magic-string": "^0.30.17",
"picocolors": "^1.1.1"
},
"pnpm": {
"onlyBuiltDependencies": [
"@swc/core",
"esbuild",
"simple-git-hooks"
]
}
}

3232
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -17,14 +17,8 @@ export default defineConfig([
output: [
{
dir: 'dist',
entryFileNames: '[name].cjs',
chunkFileNames: 'chunks/lib-[hash].cjs',
format: 'cjs'
},
{
dir: 'dist',
entryFileNames: '[name].mjs',
chunkFileNames: 'chunks/lib-[hash].mjs',
entryFileNames: '[name].js',
chunkFileNames: 'chunks/lib-[hash].js',
format: 'es'
}
],

View File

@ -7,7 +7,7 @@ const msgPath = process.argv[2]
const msg = fs.readFileSync(msgPath, 'utf-8').trim()
const commitRE =
/^(revert: )?(feat|fix|docs|dx|style|refactor|perf|test|workflow|build|ci|chore|types|wip|release)(\(.+\))?: .{1,50}/
/^(revert: )?(feat|fix|docs|dx|style|refactor|perf|test|workflow|build|ci|chore|types|wip|release)(\(.+\))?!?: .{1,50}/
if (!commitRE.test(msg)) {
console.log()

View File

@ -1,5 +1,5 @@
import { build as viteBuild } from 'vite'
import { InlineConfig, resolveConfig } from './config'
import { type InlineConfig, resolveConfig } from './config'
/**
* Bundles the electron app for production.

View File

@ -1,7 +1,7 @@
import { cac } from 'cac'
import colors from 'picocolors'
import { LogLevel, createLogger } from 'vite'
import { InlineConfig } from './config'
import { type LogLevel, createLogger } from 'vite'
import type { InlineConfig } from './config'
import { version } from '../package.json'
const cli = cac('electron-vite')
@ -131,6 +131,7 @@ cli.command('build [root]', 'build for production').action(async (root: string,
try {
await build(inlineConfig)
process.exit(0)
} catch (e) {
const error = e as Error
createLogger(options.logLevel).error(colors.red(`error during build:\n${error.stack}`), { error })

View File

@ -343,7 +343,7 @@ async function bundleConfigFile(fileName: string, isESM: boolean): Promise<{ cod
absWorkingDir: process.cwd(),
entryPoints: [fileName],
write: false,
target: ['node18'],
target: ['node20'],
platform: 'node',
bundle: true,
format: isESM ? 'esm' : 'cjs',

View File

@ -69,6 +69,7 @@ export function getElectronNodeTarget(): string {
const electronVer = getElectronMajorVer()
const nodeVer = {
'37': '22.16',
'36': '22.14',
'35': '22.14',
'34': '20.18',
@ -87,10 +88,7 @@ export function getElectronNodeTarget(): string {
'21': '16.16',
'20': '16.15',
'19': '16.14',
'18': '16.13',
'17': '16.13',
'16': '16.9',
'15': '16.5'
'18': '16.13'
}
if (electronVer && parseInt(electronVer) > 10) {
let target = nodeVer[electronVer]
@ -104,6 +102,7 @@ export function getElectronChromeTarget(): string {
const electronVer = getElectronMajorVer()
const chromeVer = {
'37': '138',
'36': '136',
'35': '134',
'34': '132',
@ -122,10 +121,7 @@ export function getElectronChromeTarget(): string {
'21': '106',
'20': '104',
'19': '102',
'18': '100',
'17': '98',
'16': '96',
'15': '94'
'18': '100'
}
if (electronVer && parseInt(electronVer) > 10) {
let target = chromeVer[electronVer]

View File

@ -1,4 +1,4 @@
export { type LogLevel, createLogger, mergeConfig, splitVendorChunkPlugin, splitVendorChunk } from 'vite'
export { type LogLevel, createLogger, mergeConfig } from 'vite'
export * from './config'
export { createServer } from './server'
export { build } from './build'

View File

@ -342,8 +342,7 @@ export function electronRendererVitePlugin(options?: ElectronPluginOptions): Plu
config(config): void {
const root = options?.root || process.cwd()
config.base =
config.mode === 'production' || process.env.NODE_ENV_ELECTRON_VITE === 'production' ? './' : config.base
config.base = config.base ?? './'
config.root = config.root || './src/renderer'
const chromeTarget = getElectronChromeTarget()

View File

@ -1,13 +1,13 @@
{
"compilerOptions": {
"target": "ES2022",
"target": "ES2023",
"module": "ESNext",
"lib": ["ESNext"],
"sourceMap": false,
"strict": true,
"allowJs": true,
"esModuleInterop": true,
"moduleResolution": "Node",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,