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

Support transform-runtime as babel-plugin-transform-runtime #234

Closed
lext-7 opened this issue Jun 5, 2018 · 1 comment
Closed

Support transform-runtime as babel-plugin-transform-runtime #234

lext-7 opened this issue Jun 5, 2018 · 1 comment

Comments

@lext-7
Copy link

lext-7 commented Jun 5, 2018

Hope it support transform-runtime.

@alangpierce
Copy link
Owner

Hi @lext-7, thanks for the report. My impression is that babel-plugin-transform-runtime doesn't make sense for Sucrase, but let me know if disagree and know more concretely what it would do. To be clear, the compiled output of Sucrase is only meant to be run on newer JS engines like Node 8+ and recent versions of Chrome and Firefox.

My understanding is that that Babel plugin serves two purposes:

  • It extracts out the various helper functions used by Babel into a shared library to avoid the functions being repeated in each file. Sucrase doesn't have any of these helper functions (aside from the interopRequire functions which aren't handled by babel-plugin-transform-runtime and don't really make sense to import), so there's nothing to extract out.
  • It provides polyfill-like transforms for some globals like Promise, Set, and Map. These are all already provided by newer JS engines, so there's no need to transform them.

Does that make sense? If you still think it would be useful, it may be good to frame it in terms of the problem you're trying to solve.

@lext-7 lext-7 closed this as completed Jun 6, 2018
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