I'm unable to create working custom transformer
See original GitHub issue[react-native 0.23][windows][android] I’m currently struggling to make typescript sourcemaps work with react-native. As advised in https://github.com/facebook/react-native/issues/393#issuecomment-173247497, I have created 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);
}
};
and when I’m executing react-native start --transformer <absolute path to this transformer
after reaload js:
here is repro:
- clone https://github.com/krtr/native-repro
npm install
react-native run-android
react-native start --transformer <absolute path to custom transformer
- tap reload js in phone/emulator
in case you want recreate sourcemaps
tsc --target es6 --jsx react index.android.tsx
(npm install typescript -g
if you dont have typescript installed)
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Unable to create working custom transformer - Stack Overflow
var transformer = require('react-native/packager/transformer'); var fs = require("fs"); module.exports = function (data, callback) { if (data.
Read more >Not able run custom transformer(pdf_to_doc) throug... - Alfresco Hub
I am trying to convert pdf to doc using a custom transformer through soffice but not able to though I am able to...
Read more >Creating a custom transformer and publishing it to the FME Hub.
I helped answer a question on the FME Community forums and wanted to create a custom transformer of the solution. Since we just...
Read more >Custom Transformer Not working in Mule 3.2
I have created a custom transformer extending the AbstractTransformer. I have configured the custom transformer in the mule-config.xml file.
Read more >How to keep attributes in custom transformer locally
I am working a lot with custom transformers lately and I noticed that if an attribute is created inside the custom transformer, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Here’s a custom transformer that sets up a pipeline that does TypeScript -> JS -> Babel transformation and all the source-map mangling required: https://github.com/artsy/emission/compare/93ab096089c3d07040511e070cb0585e66cccec2...5c6728b7058eac6a8fbd4353cd98e9f91a58ff99
@frogcjn Your custom transformer works great to me 🎉