UNPKG

@bacons/expo-metro-runtime

Version:

Tools for making experimental Metro bundler features work

52 lines (35 loc) 1.04 kB
# @bacons/expo-metro-runtime Temporary utility package for using Metro on web with lazy loading and Fast Refresh. ## Add the package to your npm dependencies ``` yarn add @bacons/expo-metro-runtime ``` ## Usage To add web support to the runtime: ```tsx import "@bacons/expo-metro-runtime"; // Rest of your app... ``` To enable React Suspense in React Native for all platforms (dev only): `metro.config.js` ```js // Learn more https://docs.expo.io/guides/customizing-metro const { getDefaultConfig } = require("expo/metro-config"); const path = require("path"); const config = getDefaultConfig(__dirname); config.transformer = { experimentalImportBundleSupport: true, asyncRequireModulePath: path.resolve( "@bacons/expo-metro-runtime/asyncRequire" ), }; module.exports = config; ``` <!-- The Fast Refresh doesn't work if the module is transpiled with TypeScript settings: ``` "target": "es2019", "module": "commonjs", ``` I imagine this is because Metro requires the import/export syntax to be present. -->