Skip to content

Commit

Permalink
fix(transformer): opt.isNormal 不需要走自定义 babel 插件
Browse files Browse the repository at this point in the history
close #3731
  • Loading branch information
yuche committed Jul 10, 2019
1 parent aed2406 commit 0945248
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions packages/taro-transformer-wx/src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ export const setTransformOptions = (options: Options) => {

export const buildBabelTransformOptions: () => TransformOptions = () => {
Status.isSFC = false
let plugins = [
require('babel-plugin-transform-do-expressions'),
require('babel-plugin-transform-export-extensions'),
require('babel-plugin-transform-flow-strip-types'),
buildVistor(),
functionalComponent,
[require('babel-plugin-transform-define').default, transformOptions.env]
]
if (!transformOptions.isNormal) {
plugins.push(buildVistor(), functionalComponent)
}
return {
parserOpts: {
sourceType: 'module',
Expand All @@ -51,14 +62,7 @@ export const buildBabelTransformOptions: () => TransformOptions = () => {
'exportExtensions'
] as any[]
},
plugins: [
require('babel-plugin-transform-do-expressions'),
require('babel-plugin-transform-export-extensions'),
require('babel-plugin-transform-flow-strip-types'),
buildVistor(),
functionalComponent,
[require('babel-plugin-transform-define').default, transformOptions.env]
].concat(process.env.ESLINT === 'false' || transformOptions.isNormal || transformOptions.isTyped ? [] : eslintValidation)
plugins: plugins.concat(process.env.ESLINT === 'false' || transformOptions.isNormal || transformOptions.isTyped ? [] : eslintValidation)
.concat((isTestEnv) ? [] : require('babel-plugin-remove-dead-code').default)
}
}

0 comments on commit 0945248

Please sign in to comment.