https://github.com/vite-plugin/vite-plugin-webpack-prebundle
A webpack-based pre-bundle solution, mainly used to support Node.js and Electron.
https://github.com/vite-plugin/vite-plugin-webpack-prebundle
Last synced: 3 months ago
JSON representation
A webpack-based pre-bundle solution, mainly used to support Node.js and Electron.
- Host: GitHub
- URL: https://github.com/vite-plugin/vite-plugin-webpack-prebundle
- Owner: vite-plugin
- License: mit
- Created: 2024-06-26T00:34:01.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-01T02:14:43.000Z (almost 2 years ago)
- Last Synced: 2025-10-20T02:16:03.554Z (7 months ago)
- Language: TypeScript
- Size: 53.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# vite-plugin-webpack-prebundle
A Webpack-based pre-bundle solution, mainly used for adapting Node.js and Electron.
[](https://npmjs.org/package/vite-plugin-webpack-prebundle)
[](https://npmjs.org/package/vite-plugin-webpack-prebundle)
English | [简体中文](./README.zh-CN.md)
## Install
```bash
npm i -D vite-plugin-webpack-prebundle
```
## Usage
```js
import prebundle from 'vite-plugin-webpack-prebundle'
export default {
plugins: [
prebundle({
modules: [
'foo',
'bar',
],
})
]
}
```
## API
```ts
export interface PrebundleOptions {
/** An array of module names that need to be pre-bundle. */
modules: string[]
config?: (config: Configuration) => Configuration | undefined | Promise
}
```
## Why
This is a Pre-Bundle solution designed for Node/Electron Apps, which is consistent with Vite's built-in [Dependency Pre-Bundling](https://vitejs.dev/guide/dep-pre-bundling.html#dependency-pre-bundling) behavior. The reason for using Webpack is that it's currently the most compatible bundler for Node/Electron Apps.
## Compare
Pre-Bundle solution
Web
Node/Electron
Vite's built-in Dependency Pre-Bundling
✅
❌
vite-plugin-webpack-prebundle
✅
✅