@cpp.js/plugin-metro

1.0.0-beta.4 • Public • Published

@cpp.js/plugin-metro

Cpp.js Metro plugin
A tool for seamless C++ integration with the Metro bundler.

NPM version License Docs - React Native Docs - Expo

Integration

To integrate cpp.js into your project using Metro as a bundler, you can utilize the @cpp.js/plugin-metro plugin. Start by installing these package with the following command:

NPM

npm install @cpp.js/plugin-metro --save-dev

or YARN

yarn add @cpp.js/plugin-metro --dev

or PNPM

pnpm add @cpp.js/plugin-metro --save-dev

or BUN

bun add @cpp.js/plugin-metro --dev

To enable the plugin, modify the metro.config.js file as shown below.

React Native

const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');
+const CppjsMetroPlugin = require('@cpp.js/plugin-metro');

/**
 * Metro configuration
 * https://reactnative.dev/docs/metro
 *
 * @type {import('metro-config').MetroConfig}
 */
-const config = {};
+const config = {
+    ...CppjsMetroPlugin(getDefaultConfig(__dirname)),
+};

module.exports = mergeConfig(getDefaultConfig(__dirname), config);

Expo

// Learn more https://docs.expo.io/guides/customizing-metro
const { getDefaultConfig } = require('expo/metro-config');
+const { mergeConfig } = require('metro-config');
+const CppjsMetroPlugin = require('@cpp.js/plugin-metro');

/** @type {import('expo/metro-config').MetroConfig} */
const config = getDefaultConfig(__dirname);

+const newConfig = {
+    ...CppjsMetroPlugin(config),
+};

-module.exports = config;
+module.exports = mergeConfig(config, newConfig);

Package Sidebar

Install

npm i @cpp.js/plugin-metro

Weekly Downloads

5

Version

1.0.0-beta.4

License

MIT

Unpacked Size

9.01 kB

Total Files

6

Last publish

Collaborators

  • bugra9