Skip to content

Latest commit

 

History

History
67 lines (53 loc) · 1.59 KB

README.md

File metadata and controls

67 lines (53 loc) · 1.59 KB

vite-plugin-webpack-prebundle

A Webpack-based pre-bundle solution, mainly used for adapting Node.js and Electron.

NPM version NPM Downloads

English | 简体中文

Install

npm i -D vite-plugin-webpack-prebundle

Usage

import prebundle from 'vite-plugin-webpack-prebundle'

export default {
  plugins: [
    prebundle({
      modules: [
        'foo',
        'bar',
      ],
    })
  ]
}

API

export interface PrebundleOptions {
  /** An array of module names that need to be pre-bundle. */
  modules: string[]
  config?: (config: Configuration) => Configuration | undefined | Promise<Configuration | undefined>
}

Why

This is a Pre-Bundle solution designed for Node/Electron Apps, which is consistent with Vite's built-in 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