Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alex8088/vite-plugin-electron-config
Electron plugin for Vite
https://github.com/alex8088/vite-plugin-electron-config
electron vite vite-plugin
Last synced: 18 days ago
JSON representation
Electron plugin for Vite
- Host: GitHub
- URL: https://github.com/alex8088/vite-plugin-electron-config
- Owner: alex8088
- License: mit
- Created: 2022-03-17T06:15:50.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-04-02T09:24:15.000Z (over 2 years ago)
- Last Synced: 2024-09-19T20:10:48.858Z (about 2 months ago)
- Topics: electron, vite, vite-plugin
- Language: TypeScript
- Homepage:
- Size: 22.5 KB
- Stars: 7
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# vite-plugin-electron-config
> Electron plugin for Vite
---
## Features
- 🏠Presets for main process:
- **target**: `node*`, automatically match node target of `Electron`. For example, the node target of Electron 17 is `node16.13`
- **lib.entry**: `{index|main}.{js|ts|mjs|cjs}`(relative to root from vite config file), empty string if not found
- **lib.formats**: `cjs`
- **rollupOptions.external**: `electron` and all builtin modules, and it will merge automatically with the external module ids added by user
- đź”—Presets for preload script:
- **target**: the same as `main`
- **lib.entry**: `{index|preload}.{js|ts|mjs|cjs}`(relative to root from vite config file), empty string if not found
- **lib.formats**: `cjs`
- **rollupOptions.external**: the same as `main`
- 🌴Presets for renderer process:
- **target**: `chrome*`, automatically match chrome target of `Electron`. For example, the chrome target of Electron 17 is `chrome98`
- **polyfillModulePreload**: `false`, there is no need to polyfill `Module Preload` for the Electron renderer
- **rollupOptions.external**: the same as `main`
- 🔧Resolved config checking## Install
```sh
npm i vite-plugin-electron-config -D
```## Usage
### Main Process
```js
import { defineConfig } from 'vite'
import { electronMain } from 'vite-plugin-electron-config'export default defineConfig({
plugins: [electronMain()]
})
```### Preload Script
```js
import { defineConfig } from 'vite'
import { electronPreload } from 'vite-plugin-electron-config'export default defineConfig({
plugins: [electronPreload()]
})
```### Renderer Process
```js
import { defineConfig } from 'vite'
import { electronRenderer } from 'vite-plugin-electron-config'export default defineConfig({
plugins: [electronRenderer()]
})
```## Recommended
[electron-vite](https://github.com/alex8088/electron-vite), an Electron CLI integrated with Vite, make you easy to use Vite.
## License
[MIT](./LICENSE) License © 2022 Alex Wei