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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename import #60

Open
jamesmsk opened this issue Jan 18, 2022 · 2 comments
Open

Rename import #60

jamesmsk opened this issue Jan 18, 2022 · 2 comments

Comments

@jamesmsk
Copy link

I'm using this package to have a react js copy of my react typescript components. Is it possible to control the import name?

currently its

import _pt from 'prop-types';

I would like to have control of name instead of _pt

@milesj
Copy link
Owner

milesj commented Jan 18, 2022

@jamesmsk If an import already exists, the plugin will use that name, otherwise no.

Curious why you need this? This is an abstraction that isn't used directly.

@jamesmsk
Copy link
Author

jamesmsk commented Jan 18, 2022

@jamesmsk If an import already exists, the plugin will use that name, otherwise no.

Curious why you need this? This is an abstraction that isn't used directly.

Our mono repo's react components are all written in TypeScript and we needed to compensate for contributors who do not work with TypeScript. Readability and speed of development are the reasons for this. When I transpile from React TS to JS, I want the contributors to have a js version of the source file that they can comprehend quickly. So, in this example, I wanted babel to punch out js files with import PropTypes from 'prop-types to keep with the syntax they are historically using.

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

No branches or pull requests

2 participants