UNPKG

1.52 kBJavaScriptView Raw
1"use strict";
2var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3 return new (P || (P = Promise))(function (resolve, reject) {
4 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6 function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
7 step((generator = generator.apply(thisArg, _arguments || [])).next());
8 });
9};
10Object.defineProperty(exports, "__esModule", { value: true });
11exports.default = (ctx) => {
12 ctx.registerPlatform({
13 name: 'h5',
14 useConfigName: 'h5',
15 fn({ config }) {
16 return __awaiter(this, void 0, void 0, function* () {
17 const { build } = require('../../h5');
18 const { appPath, outputPath } = ctx.paths;
19 const { isWatch, port } = ctx.runOpts;
20 const { emptyDirectory } = ctx.helper;
21 const { modifyWebpackChain, modifyBuildAssets, onBuildFinish } = config;
22 emptyDirectory(outputPath);
23 build(appPath, {
24 watch: isWatch,
25 port
26 }, {
27 modifyWebpackChain,
28 modifyBuildAssets,
29 onBuildFinish
30 });
31 });
32 }
33 });
34};