问题
For example, is there an option to pass Babel to only transpile arrow functions, or let/const?
My use case is to remove transpiling for certain features as browsers widely support them.
回答1:
Yes, you can pass a whitelist
option to specify specific transformations to run, or a blacklist
to specific transformations to disable.
They are listed here: http://babeljs.io/docs/advanced/transformers/. See also: http://babeljs.io/docs/usage/options/
Update:
The answer above applies to Babel 5. In Babel 6, all plugins are explicitly enabled either directly or via "presets" which bundle plugins together. You cannot blacklist specific plugins, but you may list only the plugins you want, excluding the ones you do not wish to run.
来源:https://stackoverflow.com/questions/31079261/can-you-choose-which-es6-features-to-transpile-with-babel