@cpp.js/plugin-metro
v1.0.0-beta.32
Published
Cpp.js Metro plugin: A tool for seamless C++ integration with the Metro bundler.
Downloads
888
Maintainers
Readme
@cpp.js/plugin-metro
Cpp.js Metro plugin
A tool for seamless C++ integration with the Metro bundler.
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);