From a417111e60e4b3c5ba36e2350957ed9ef53dfbae Mon Sep 17 00:00:00 2001 From: Nouman Sakhawat <48842733+NoumanSakhawat@users.noreply.github.com> Date: Tue, 7 Jul 2020 11:03:54 +0500 Subject: [PATCH] Update README.md --- README.md | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f39118b..639a95e 100644 --- a/README.md +++ b/README.md @@ -90,13 +90,29 @@ Check the android TensorFlow example for more information on the API: https://gi - Add as react native asset -Create the file `rn-cli.config.js` in the root of the project and add the following code where the array contains all the file endings you want to bundle (in this case we bundle pb and txt files next to the defaults). +Create the file `metro.config.js` in the root of the project and add the following code where the array contains all the file endings you want to bundle (in this case we bundle pb and txt files next to the defaults). ``` +const defaultAssetExts = require("metro-config/src/defaults/defaults").assetExts; + + module.exports = { - getAssetExts() { - return ['pb', 'txt'] - } -} + + transformer: { + getTransformOptions: async () => ({ + transform: { + experimentalImportSupport: false, + inlineRequires: false, + }, + }), + }, + + + resolver: { + assetExts: [...defaultAssetExts, 'pb', 'txt',], + + }, +}; + ``` Then you can require the asset in the code, for example: `require('assets/tensorflow_inception_graph.pb')`