facebook/idx

Doesn't work with TS compiler

Closed this issue · 3 comments

I've got a project that use: TS, React, Webpack, Babel, idx, and kept having issues with IE11. After digging a bit deeper I realised the TS compiler, which runs first in the build chain, prevents babel-plugin-idx from transpiling idx because it obfuscates the import and usage.

This may have been obvious, but I didn't realise until recently. I think it should be mentioned explicitly in the readme that you have to use @babel/plugin-transform-typescript and NOT the TS compiler.

I haven't found a workaround yet, I'd like to have type checking when creating my production build. If anyone has dealt with this I would love to know.

I'm happy to make a PR for the readme update if you'd like.

@sseppola Have you tried setting your tsconfig's 'module' and 'target' to at least "es2015"
That should solve the problem of the plugin being confused

Agreed that it should probably still be mentioned in the readme

Here's a minimal project setup with the babel-plugin-typescript working alongside/after tsc
https://github.com/cheapsteak/idx-tsc-babel-example

tsc runs first, then babel after

Ah, makes so much sense now that you say it, but I didn't realise I could do that!
This is awesome, thank you @cheapsteak!