Skip to content

Commit

Permalink
fix(cli): 修复在taro编译配置文件中获取不到TARO_ENV的问题,fix #11634
Browse files Browse the repository at this point in the history
  • Loading branch information
Chen-jj committed Apr 13, 2022
1 parent 789e873 commit 0a96e1a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 6 additions & 0 deletions packages/taro-cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ export default class CLI {

// 设置环境变量
process.env.NODE_ENV ||= args.env || (args.watch ? 'development' : 'production')
if (args.type) {
process.env.TARO_ENV = args.type
}
if (typeof args.plugin === 'string') {
process.env.TARO_ENV = 'plugin'
}

const kernel = new Kernel({
appPath,
Expand Down
5 changes: 0 additions & 5 deletions packages/taro-cli/src/commands/customCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ export default function customCommand (
}
})

// 设置环境变量
if (options.platform) {
process.env.TARO_ENV = options.platform
}

kernel.run({
name: command,
opts: {
Expand Down

0 comments on commit 0a96e1a

Please sign in to comment.