Closed olofd closed 6 years ago
haha thanks. I'll test this now.
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.
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.)
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.
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.
alternatively, I could try using babel 7 with the typescript support.
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.
Heh, thanks Steve 😁 I didn't know that! I'll check what the latest is on babel 7.
On 8 Jan 2018 17:37, "Steve Kellock" notifications@github.com wrote:
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.
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/ds300/react-native-typescript-transformer/pull/37#issuecomment-356037702, or mute the thread https://github.com/notifications/unsubscribe-auth/ABL1qee8KLKxSSPkUnoMGDId0Ooph8b9ks5tIlJugaJpZM4RWhKL .
Dropping sourceMap support temporally sounds like a good idea for a quick fix to support RN 0.52. Later on it can be restored.
Source mapping is now working again as of 1.1.7 :tada:
I love you.
Steve, I thought we said we'd keep our love hidden 😊
Sorry, i get too emotional when people try to take my TypeScript away.
Sigh