{"id":26161,"library":"react-native-hardwired-transpiler","title":"react-native-hardwired-transpiler","description":"A transpiler module for the react-native-hardwired ecosystem that transforms ES6+ JavaScript code into a format compatible with Hardwired's dynamic module loading in React Native. This package is part of the Hardwired library enabling runtime code transformation and execution. Version 0.10.1 is the current stable release. It is designed specifically for React Native environments and relies on Babel for transpilation. Differentiates from other transpilers by tight integration with Hardwired's dynamic loading system.","status":"active","version":"0.10.1","language":"javascript","source_language":"en","source_url":"https://github.com/JedrzejMajko/react-native-hardwired","tags":["javascript"],"install":[{"cmd":"npm install react-native-hardwired-transpiler","lang":"bash","label":"npm"},{"cmd":"yarn add react-native-hardwired-transpiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add react-native-hardwired-transpiler","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used for transpiling ES6+ code to a format compatible with Hardwired's dynamic module loading.","package":"@babel/core","optional":false},{"reason":"Provides preset configurations for Babel transpilation targeting specific environments.","package":"@babel/preset-env","optional":false},{"reason":"Core library that this transpiler works with for dynamic module loading.","package":"react-native-hardwired","optional":false}],"imports":[{"note":"ESM-only; CommonJS require may lead to 'exports is not defined' errors.","wrong":"const transpile = require('react-native-hardwired-transpiler').transpile","symbol":"transpile","correct":"import { transpile } from 'react-native-hardwired-transpiler'"},{"note":"Default export is a class; named import will be undefined.","wrong":"import { HardwiredTranspiler } from 'react-native-hardwired-transpiler'","symbol":"HardwiredTranspiler","correct":"import HardwiredTranspiler from 'react-native-hardwired-transpiler'"},{"note":"TypeScript only; importing as value will fail at runtime.","wrong":"import { TranspilerOptions } from 'react-native-hardwired-transpiler'","symbol":"TranspilerOptions","correct":"import type { TranspilerOptions } from 'react-native-hardwired-transpiler'"}],"quickstart":{"code":"import { transpile } from 'react-native-hardwired-transpiler';\nimport { HardwiredRegistry } from 'react-native-hardwired';\n\nconst code = `export default () => { return 'Hello from Hardwired!'; }`;\nconst options = { filename: 'dynamic.js', presets: ['@babel/preset-env'] };\n\ntranspile(code, options).then(result => {\n  HardwiredRegistry.register('dynamic', result.code);\n  const module = HardwiredRegistry.load('dynamic');\n  console.log(module.default()); // 'Hello from Hardwired!'\n}).catch(err => console.error(err));","lang":"typescript","description":"Shows how to transpile ES6 code and register it with Hardwired's dynamic module loader."},"warnings":[{"fix":"Use async/await or .then() to access the result.","message":"The transpile() function now returns a Promise instead of a synchronous result. Code using .code directly will break.","severity":"breaking","affected_versions":">=0.8.0"},{"fix":"Remove sourceMaps or set to an explicit object.","message":"The 'options' parameter no longer accepts 'sourceMaps' as a boolean; use 'sourceMaps: false' or omit.","severity":"deprecated","affected_versions":">=0.9.0"},{"fix":"Run 'npm install @babel/core'.","message":"The transpiler requires @babel/core to be installed as a peer dependency. Missing it causes cryptic 'Cannot find module' errors.","severity":"gotcha","affected_versions":"all"},{"fix":"Add 'useBuiltIns: false' to options or avoid importing large polyfills.","message":"Using transpile() in React Native's Hermes engine may fail due to missing global objects. Transpiled code should avoid certain ES6 features.","severity":"gotcha","affected_versions":"all"},{"fix":"Switch to import { transpile } from 'react-native-hardwired-transpiler'.","message":"The default export HardwiredTranspiler class is deprecated in favor of the named transpile function.","severity":"deprecated","affected_versions":">=0.10.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use import { transpile } from 'react-native-hardwired-transpiler'.","cause":"Using CommonJS require() on an ES module default export.","error":"TypeError: (0 , _transpiler.transpile) is not a function"},{"fix":"Run 'npm install @babel/core'.","cause":"Missing peer dependency @babel/core.","error":"Error: Cannot find module '@babel/core'"},{"fix":"Use await transpile(code, options) or .then(result => { ... }).","cause":"Calling transpile() without awaiting the promise (result is undefined).","error":"TypeError: Cannot read property 'code' of undefined"},{"fix":"Add a Babel preset like '@babel/preset-env' with modules: false and appropriate targets.","cause":"Transpiled code contains syntax that is not supported by Hermes or React Native's JavaScript engine.","error":"SyntaxError: Unexpected token (1:0) in file 'dynamic.js'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}