taro
taro copied to clipboard
Cannot use the decorators and decorators-legacy plugin together
版本
taro next-rc.6
问题描述
将babel.config.js设置如下:
{
presets: [
['taro', {
framework: 'react',
ts: true,
loose: true,
decoratorsBeforeExport: true,
decoratorsLegacy: false
}]
]
}
报错信息
Cannot use the decorators and decorators-legacy plugin together
补充信息
打印babel最终的plugins大致如下
[ 'decorators-legacy',
'classProperties',
'classPrivateProperties',
'objectRestSpread',
'nullishCoalescingOperator',
'optionalChaining',
'jsonStrings',
'optionalCatchBinding',
'asyncGenerators',
'objectRestSpread',
'dynamicImport',
[ 'decorators', { decoratorsBeforeExport: true } ],
'classProperties',
'classPrivateProperties',
...
]
decorators-legacy与decorators重复了,decorators-legacy是babel6中的transform,babel 7不需要了吧
补充一下,之所以需要这么设置是因为同时使用 decorators 和 class-properties 时,必须这样设置
+1
👀