vite-plugin-native
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

vite-plugin-native

Supports Node/Electron C/C++ native addons. It is a bundle solution based on Webpack.

Thanks Erick Zhao for providing inspiration :)

NPM version NPM Downloads

English | 简体中文

Install

npm i -D vite-plugin-native

Usage

import native from 'vite-plugin-native'

export default {
  plugins: [
    native({
      // Enable Webpack
      webpack: {},
    })
  ]
}

API

export interface NativeOptions {
  /** @default 'node_natives' */
  assetsDir?: string
  /** By default native modules are automatically detected if this option is not explicitly configure by the user. */
  natives?: string[] | ((natives: string[]) => string[])
  /** Enable and configure webpack. */
  webpack?: {
    config?: (config: Configuration) => Configuration | undefined | Promise<Configuration | undefined>
    'node-loader'?: NodeLoaderOptions,
    '@vercel/webpack-asset-relocator-loader'?: WebpackAssetRelocatorLoader,
  },
}

How to work

TODO: Translate into English.

See 👉🏻 工作原理 (How to work)

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.0.1
    59
    • latest

Version History

Package Sidebar

Install

npm i vite-plugin-native

Weekly Downloads

125

Version

2.0.1

License

MIT

Unpacked Size

35.9 kB

Total Files

9

Last publish

Collaborators

  • caoxie