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

Make React development mode an option #266

Closed
arv opened this issue Jun 18, 2018 · 3 comments
Closed

Make React development mode an option #266

arv opened this issue Jun 18, 2018 · 3 comments

Comments

@arv
Copy link
Contributor

arv commented Jun 18, 2018

transform('<a/>', {transforms: ['jsx']});

generates code that has __self and __source props. This is normally only enabled when you use preset-react with development to true.

@alangpierce
Copy link
Owner

Heh, I had a feeling someone would request this. I've been trying to keep this project zero/low-configuration and focused on the "fast development builds" use case, but I suppose it's reasonable that people would want the same code running in dev and prod. FWIW, my use case at work is to only use it in development and still use Babel and tsc for prod builds, since we still want to support IE. Production builds are also already slower, and they run in CI anyway, so the speed gains from Sucrase are unimportant there.

Do you have thoughts on the right config here? Currently I'm thinking there can be a new production?: boolean in the options, which will exclude __self and __source. In the future, if some other transform wants to behave differently in dev and prod, it can use that flag. If there's a real use case for configuring the transforms individually, then that can be done with new options, but I'd prefer to keep the config small.

Happy to accept a PR (using the production flag above), or I can try implementing it when I get a chance.

@arv
Copy link
Contributor Author

arv commented Jun 21, 2018

I have this working already. I wanted to send the other more straight forward PR first to get a better hang of the process in this project.

@alangpierce
Copy link
Owner

Fixed with #270.

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