0.1.0 • Published 12 months ago

vite-plugin-webpack-prebundle v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

vite-plugin-webpack-prebundle

一个基于 Webpack 的预构建(pre-bundle) 方案, 主要用于适配 Node.js 和 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

这是一个专为 Node/Electron 应用而生的 Pre-Bundling 方案,与 Vite 内置的 Dependency Pre-Bundling 行为一致。使用 Webpack 的原因是对于 Node/Electron 应用来说,它是目前兼容性最好的 Bundler。

对比

0.1.0

12 months ago