正如https://github.com/facebook/react-native/issues/393#issuecomment-173247497所述, 我已经创建了自定义变换器,但无法使其正常工作。
变压器:
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);
}
};
摄制:
<absolute path to transformer.js>
reload js