0
babel-node
似乎包括所有变压器(未验证),包括应该是可选的变压器。为什么babel-node CLI似乎包含所有变形金刚?
我不想那样。我只想要默认功能。我现在正在做的是blacklist
ing我不想要的可选转换。
这是怎么回事?我在这里错过了什么吗?网站上的文档是错误还是过时?
babel-node
似乎包括所有变压器(未验证),包括应该是可选的变压器。为什么babel-node CLI似乎包含所有变形金刚?
我不想那样。我只想要默认功能。我现在正在做的是blacklist
ing我不想要的可选转换。
这是怎么回事?我在这里错过了什么吗?网站上的文档是错误还是过时?
这个答案将假设使用Babel 6,其中es2015是最常用的预设,其中包括babel-plugin-transform-es2015-modules-commonjs。
我给你三种方法来解决这个问题:
{
"presets": ["es2015-native-modules"],
}
{
"presets": ["es2015"],
"disablePlugins": ["babel-plugin-transform-es2015-modules-commonjs"]
}
{
plugins: [
'transform-es2015-template-literals',
'transform-es2015-literals',
'transform-es2015-function-name',
'transform-es2015-arrow-functions',
'transform-es2015-block-scoped-functions',
'transform-es2015-classes',
'transform-es2015-object-super',
'transform-es2015-shorthand-properties',
'transform-es2015-computed-properties',
'transform-es2015-for-of',
'transform-es2015-sticky-regex',
'transform-es2015-unicode-regex',
'check-es2015-constants',
'transform-es2015-spread',
'transform-es2015-parameters',
'transform-es2015-destructuring',
'transform-es2015-block-scoping',
'transform-es2015-typeof-symbol',
['transform-regenerator', { async: false, asyncGenerators: false }],
],
}
你有例子吗?它不应该与正常编译命令有任何不同。 – loganfsmyth