Skip to content

A webpack-based pre-bundle solution, mainly used to support Node.js and Electron.

License

Notifications You must be signed in to change notification settings

vite-plugin/vite-plugin-webpack-prebundle

Repository files navigation

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

About

A webpack-based pre-bundle solution, mainly used to support Node.js and Electron.

Resources

License

Stars

Watchers

Forks

Packages

No packages published