Skip to content

Commit

Permalink
feat(RN): 添加装饰器写法的支持
Browse files Browse the repository at this point in the history
  • Loading branch information
Pines-Cheng committed Aug 21, 2018
1 parent 5cff2e9 commit 31b6d21
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/taro-cli/src/rn.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ const PACKAGES = {
function getJSAst (code) {
return babel.transform(code, {
parserOpts: babylonConfig,
plugins: ['babel-plugin-transform-jsx-stylesheet']
plugins: [
'transform-decorators-legacy',
'babel-plugin-transform-jsx-stylesheet'
]
}).ast
}

Expand All @@ -79,6 +82,7 @@ function parseJSCode (code, filePath) {
ast = getJSAst(code)
} catch (e) {
if (e.name === 'ReferenceError') {
npmProcess.getNpmPkgSync('babel-plugin-transform-decorators-legacy')
npmProcess.getNpmPkgSync('babel-plugin-transform-jsx-stylesheet')
ast = getJSAst(code)
} else {
Expand Down

0 comments on commit 31b6d21

Please sign in to comment.