Skip to content

Added support for RN >= 0.52 #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 8, 2018
Merged

Added support for RN >= 0.52 #37

merged 1 commit into from
Jan 8, 2018

Conversation

olofd
Copy link
Contributor

@olofd olofd commented Jan 8, 2018

Sigh

@ds300
Copy link
Owner

ds300 commented Jan 8, 2018

haha thanks. I'll test this now.

@olofd
Copy link
Contributor Author

olofd commented Jan 8, 2018

This is suppose to be there I think, but I'm getting other errors now that might be related to changes in metro and source maps handling in 0.52. So hold of merge and release.

I'm getting this crash now:

 TypeError: Cannot read property 'sections' of undefined
    at new SourceMapConsumer (/Volumes/Data/git/hansa-event/App/node_modules/source-map/lib/source-map-consumer.js:20:20)
    at composeSourceMaps (/Volumes/Data/git/hansa-event/App/node_modules/react-native-typescript-transformer/index.js:90:25)
    at Object.module.exports.transform (/Volumes/Data/git/hansa-event/App/node_modules/react-native-typescript-transformer/index.js:193:9)
    at Object.transformCode [as transform] (/Volumes/Data/git/hansa-event/App/node_modules/metro/src/JSTransformer/worker/index.js:207:15)
    at execMethod (/Volumes/Data/git/hansa-event/App/node_modules/jest-worker/build/child.js:92:29)

half-way though the bundling-process.

@olofd
Copy link
Contributor Author

olofd commented Jan 8, 2018

Yepp @ds300 . Got it to run on 0.52.
But besides this fix, something has happened in function composeSourceMaps at line 89 in this project's index.js.

The babelMap comes in as undefined, making the packager crash.
I just tested inserting this to verify that it runs without it, and it does:

function composeSourceMaps(tsMap, babelMap, tsFileName, tsContent, babelCode) {
  if (!babelMap) return {};

But the fix in this PR should be merged, and I leave the rest around sourceMaps to you (You might have a better idea on how to trace that change.)

@ds300
Copy link
Owner

ds300 commented Jan 8, 2018

Ok thanks for the initial work. I just had a quick look, and it seems that the upstream transformer has changed significantly. Will have to figure out how to support it.

@ds300 ds300 merged commit 5c428f8 into ds300:master Jan 8, 2018
@ds300
Copy link
Owner

ds300 commented Jan 8, 2018

The upstream transformer only returns the AST now, no source map. On the surface it looks like we won't be able to support source mapping from 0.52 onwards without submitting a PR to metro.

@ds300
Copy link
Owner

ds300 commented Jan 8, 2018

alternatively, I could try using babel 7 with the typescript support.

@skellock
Copy link

skellock commented Jan 8, 2018

I think there's a few things that babel's typescript parser doesn't support. const enum and namespaces. (caveat: my knowledge is about a month old, and I haven't kept up to date on babel 7 + ts).

You probably already know this, but just wanted to throw that out there as a heads up.

Lemme know if there's anything I can do to help including: cheering, buying beer, testing, researching, whatever.

@ds300
Copy link
Owner

ds300 commented Jan 8, 2018 via email

@dluksza
Copy link

dluksza commented Jan 9, 2018

Dropping sourceMap support temporally sounds like a good idea for a quick fix to support RN 0.52. Later on it can be restored.

@ds300
Copy link
Owner

ds300 commented Jan 10, 2018

Source mapping is now working again as of 1.1.7 🎉

@skellock
Copy link

I love you.

@ds300
Copy link
Owner

ds300 commented Jan 10, 2018

Steve, I thought we said we'd keep our love hidden 😊

@skellock
Copy link

Sorry, i get too emotional when people try to take my TypeScript away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants