Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vite-plugin/vite-plugin-native
Supports Node/Electron C/C++ native addons
https://github.com/vite-plugin/vite-plugin-native
Last synced: 1 day ago
JSON representation
Supports Node/Electron C/C++ native addons
- Host: GitHub
- URL: https://github.com/vite-plugin/vite-plugin-native
- Owner: vite-plugin
- License: mit
- Created: 2023-05-30T02:25:11.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-15T08:13:47.000Z (about 2 months ago)
- Last Synced: 2024-11-01T09:38:47.043Z (8 days ago)
- Language: TypeScript
- Homepage:
- Size: 169 KB
- Stars: 13
- Watchers: 0
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- fucking-awesome-vite - vite-plugin-native - Supports Node/Electron C/C++ native addons. (Plugins / Framework-agnostic Plugins)
- awesome-vite - vite-plugin-native - Supports Node/Electron C/C++ native addons. (Plugins / Framework-agnostic Plugins)
README
# vite-plugin-native
Supports Node/Electron C/C++ native addons. It is a bundle solution based on [Webpack](https://github.com/webpack/webpack).
> Thanks [Erick Zhao](https://github.com/erickzhao) for providing inspiration :)
[![NPM version](https://img.shields.io/npm/v/vite-plugin-native.svg)](https://npmjs.org/package/vite-plugin-native)
[![NPM Downloads](https://img.shields.io/npm/dm/vite-plugin-native.svg)](https://npmjs.org/package/vite-plugin-native)English | [įŽäŊä¸æ](./README.zh-CN.md)
## Install
```bash
npm i -D vite-plugin-native
```## Usage
```js
import native from 'vite-plugin-native'export default {
plugins: [
native({
// Enable Webpack
webpack: {},
})
]
}
```## API
```ts
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.
* @deprecated use `ignore` option instead
*/
natives?: string[] | ((natives: string[]) => string[])
/** Ignore the specified native module. */
ignore?: (name: string) => boolean | undefined
/** Force copy *.node files to dist/node_modules path if Webpack can't bundle native modules correctly. */
forceCopyIfUnbuilt?: true
/** Enable and configure webpack. */
webpack?: {
config?: (config: Configuration) => Configuration | undefined | Promise
'node-loader'?: NodeLoaderOptions,
'@vercel/webpack-asset-relocator-loader'?: WebpackAssetRelocatorLoader,
},
}
```## How to work
> TODO: Translate into English.
See đđģ [åˇĨäŊåį (How to work)](./README.zh-CN.md#åˇĨäŊåį)