Skip to content

Commit

Permalink
feat(cli): 替换 babel-plugin-danger-remove-unused-import 插件
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyadam committed Nov 5, 2018
1 parent 2499a4a commit 3e5cdf1
Show file tree
Hide file tree
Showing 6 changed files with 560 additions and 1,152 deletions.
2 changes: 1 addition & 1 deletion packages/taro-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"autoprefixer": "^8.4.1",
"babel-core": "^6.26.3",
"babel-generator": "^6.26.1",
"babel-plugin-danger-remove-unused-import": "^1.0.13",
"babel-plugin-danger-remove-unused-import-taro": "^1.0.0",
"babel-plugin-remove-dead-code": "^1.3.2",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-define": "^1.3.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/taro-cli/src/h5.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function processEntry (code, filePath) {

ast = babel.transformFromAst(ast, '', {
plugins: [
[require('babel-plugin-danger-remove-unused-import'), { ignore: ['@tarojs/taro', 'react', 'nervjs'] }]
[require('babel-plugin-danger-remove-unused-import-taro'), { ignore: ['@tarojs/taro', 'react', 'nervjs'] }]
]
}).ast

Expand Down Expand Up @@ -485,7 +485,7 @@ function processOthers (code, filePath) {

ast = babel.transformFromAst(ast, '', {
plugins: [
[require('babel-plugin-danger-remove-unused-import'), { ignore: ['@tarojs/taro', 'react', 'nervjs'] }]
[require('babel-plugin-danger-remove-unused-import-taro'), { ignore: ['@tarojs/taro', 'react', 'nervjs'] }]
]
}).ast

Expand Down
2 changes: 1 addition & 1 deletion packages/taro-cli/src/rn/transformJS.js
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ function parseJSCode ({code, filePath, isEntryFile, projectConfig}) {
plugins: [
[require('babel-plugin-transform-jsx-to-stylesheet'), {filePath}],
require('babel-plugin-transform-decorators-legacy').default,
[require('babel-plugin-danger-remove-unused-import'), {ignore: ['@tarojs/taro', 'react', 'react-native', 'nervjs']}],
[require('babel-plugin-danger-remove-unused-import-taro'), {ignore: ['@tarojs/taro', 'react', 'react-native', 'nervjs']}],
[require('babel-plugin-transform-define').default, constantsReplaceList]
]
}).ast
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-cli/src/weapp.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ function parseAst (type, ast, depComponents, sourceFilePath, filePath, npmSkip =
}, Util.generateEnvList(projectConfig.env || {}), Util.generateConstantsList(projectConfig.defineConstants || {}))
ast = babel.transformFromAst(ast, '', {
plugins: [
[require('babel-plugin-danger-remove-unused-import'), { ignore: ['@tarojs/taro', 'react', 'nervjs'] }],
[require('babel-plugin-danger-remove-unused-import-taro'), { ignore: ['@tarojs/taro', 'react', 'nervjs'] }],
[require('babel-plugin-transform-define').default, constantsReplaceList]
]
}).ast
Expand Down
Loading

0 comments on commit 3e5cdf1

Please sign in to comment.