javascript - Unable to create working custom transformer -
as advised in https://github.com/facebook/react-native/issues/393#issuecomment-173247497, have created custom transformer unable make work.
transformer:
var transformer = require('react-native/packager/transformer'); var fs = require("fs"); module.exports = function (data, callback) { if (data.filename.indexof("index.android.js") !== -1) { callback({ code: data.sourcecode, map: json.parse(fs.readfilesync("./index.android.js.map").tostring()), filename: data.filename }) } else { transformer(data, callback); } };
repro:
- clone https://github.com/krtr/native-repro
- npm install
- react-native run-android
- react-native start --transformer
<absolute path transformer.js>
- tap
reload js
in phone/emulator
Comments
Post a Comment