| 92 | |
| 93 | const handler: PiralBuildHandler = { |
| 94 | async create(options) { |
| 95 | const { 'hmr-port': defaultHmrPort = getRandomPort(), config = defaultWebpackConfig } = options.args._; |
| 96 | const hmrPort = options.hmr ? await getFreePort(defaultHmrPort) : 0; |
| 97 | const otherConfigPath = resolve(options.root, config); |
| 98 | const baseConfig = await getConfig( |
| 99 | options.entryFiles, |
| 100 | options.outDir, |
| 101 | options.externals, |
| 102 | options.emulator, |
| 103 | options.sourceMaps, |
| 104 | options.contentHash, |
| 105 | options.minify, |
| 106 | options.publicUrl, |
| 107 | hmrPort, |
| 108 | ); |
| 109 | const wpConfig = await extendConfig(baseConfig, otherConfigPath, { |
| 110 | watch: options.watch, |
| 111 | }); |
| 112 | |
| 113 | return runWebpack(wpConfig, options.logLevel); |
| 114 | }, |
| 115 | }; |
| 116 | |
| 117 | export const create = handler.create; |