@edwardxyt/gws-cli
Version:
这是一个web脚手架工具,用于生成基于webpack5,生成typescript+react17+mobx5+reactRouter6的应用。初衷是要解决多入口,多环境。单独编译单独运行的脚手架。做到小而美。拒绝锦上添花。
38 lines (35 loc) • 1.18 kB
JavaScript
const webpack_production_config = require("../config/webpack.production.config");
const webpack = require("webpack");
const path = require("path");
const debug = require("debug");
const R = require("ramda");
const fs = require("fs-extra");
const echo = debug("compile:bin");
let app_config = require("../config")(path.resolve(__dirname, "../"));
webpack_production_config().then(config => {
webpack(config).run((err, stats) => {
if (err) {
echo("webpack compile fail 编译错误!");
echo(err);
return;
}
fs.pathExists(app_config.distHtml).then(exists => {
if (!exists) {
// process.exit(0);
throw new Error(`status is ${exists}!!!! "webpack compile fail 编译错误!"`);
} else {
echo(`------------------------------ start ------------------------------`);
process.stdout.write(stats.toString({
colors: true,
modules: false,
children: false,
chunks: false,
warnings: false,
chunkModules: false
}) + '\n\n');
echo("webpack compile complete 编译完成");
echo(`------------------------------- end ------------------------------`);
}
});
});
});