1 | import { Kernel } from '@tarojs/service'
|
2 |
|
3 | export default function build (kernel: Kernel, {
|
4 | platform,
|
5 | isWatch,
|
6 | release,
|
7 | port,
|
8 | env,
|
9 | ui,
|
10 | uiIndex,
|
11 | page,
|
12 | component,
|
13 | envHasBeenSet = false,
|
14 | plugin,
|
15 | isHelp
|
16 | }: {
|
17 | platform: string,
|
18 | isWatch: boolean,
|
19 | release?: boolean
|
20 | port?: number
|
21 | env?: string
|
22 | ui?: boolean
|
23 | uiIndex?: string
|
24 | page?: string
|
25 | component?: string
|
26 | envHasBeenSet?: boolean
|
27 | plugin?: string | boolean
|
28 | isHelp?: boolean
|
29 | }) {
|
30 | if (plugin) {
|
31 | if (typeof plugin === 'boolean') {
|
32 | plugin = 'weapp'
|
33 | }
|
34 | platform = 'plugin'
|
35 | }
|
36 | if (platform === 'plugin') {
|
37 | plugin = plugin || 'weapp'
|
38 | }
|
39 | if (ui) {
|
40 | platform = 'ui'
|
41 | }
|
42 | let nodeEnv = process.env.NODE_ENV || env
|
43 | if (!nodeEnv) {
|
44 | if (isWatch) {
|
45 | nodeEnv = 'development'
|
46 | } else {
|
47 | nodeEnv = 'production'
|
48 | }
|
49 | }
|
50 | process.env.NODE_ENV = nodeEnv
|
51 | process.env.TARO_ENV = platform
|
52 | kernel.run({
|
53 | name: 'build',
|
54 | opts: {
|
55 | platform,
|
56 | isWatch,
|
57 | release,
|
58 | port,
|
59 | ui,
|
60 | uiIndex,
|
61 | page,
|
62 | component,
|
63 | envHasBeenSet,
|
64 | plugin,
|
65 | isHelp
|
66 | }
|
67 | })
|
68 | }
|