Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly specify ts and tsx extensions in babel options #96

Merged
merged 2 commits into from
May 10, 2019

Conversation

jakegavin
Copy link
Contributor

@jakegavin jakegavin commented May 9, 2019

Fixes #95

rollup-plugin-typescript2 transpiles the code but doesn't change the
file extensions. Files with ts and tsx extentions aren't processed by
Babel by default so we need to add those extensions to the babel config.

I'm not actually using tsdx on a production app (yet? we need to be able to configure babel though 馃槙) so I don't have a great way to test this with confidence for a real world project.

Also I'm seeing...

Module '"../../../../../../Users/jake/Code/jakegavin/tsdx/node_modules/@types/babel__core"' has no exported member 'DEFAULT_EXTENSIONS'

But its there. I guess it's maybe not in the babel core types. I have a PR up to add it: DefinitelyTyped/DefinitelyTyped#35336

rollup-plugin-typescript2 transpiles the code but doesn't change the
file extensions. Files with ts and tsx extentions aren't processed by
Babel by default so we need to add those extensions to the babel config.
@swyxio
Copy link
Collaborator

swyxio commented May 10, 2019

hmm. leaving this one for jared.

@jaredpalmer
Copy link
Owner

Will have to test in the morning

@jaredpalmer
Copy link
Owner

Fixed the type issue by patching the types. DEFAULT_EXTENSIONS is indeed exported.
See Line 226 https://unpkg.com/@babel/core@7.4.4/lib/index.js

@jaredpalmer
Copy link
Owner

@jakegavin thanks! Can confirm that lodash opt was not running. For reference, in Formik, we don't use rollup-plugin-typescript2, but instead we use plain old tsc to spit out an esnext .js module to the compiled directory, we then run rollup (with your babel optimizations) against that JavaScript and then copy the types to that output directory...this means i never had to deal with the extensions bit. Great catch!

@jaredpalmer jaredpalmer merged commit 6512b46 into jaredpalmer:master May 10, 2019
@agilgur5 agilgur5 added the topic: rollup-plugin-typescript2 Issues and PRs relating to rpts2 label Nov 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: rollup-plugin-typescript2 Issues and PRs relating to rpts2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Babel isn't running -- need to add TS, TSX extensions to rollup-plugin-babel config
4 participants