question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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: error

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:closed
  • Created 7 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
alloycommented, Mar 4, 2017

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

1reaction
krtrcommented, Jul 6, 2016

@frogcjn Your custom transformer works great to me 🎉

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found