0.0.4 • Published 4 years ago

@mese/builder v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

@mese/builder

打包器。

命令行使用

$ mese-build --mode=production --meseConfigUrl=mese.config.js --outputPath=dist

# 或者
$ mese-watch --mode=development --meseConfigUrl=mese.config.js --outputPath=dist

API

builder.build

const path = require("path");
const builder = require("@mese/builder");
const [mode, meseConfigUrl, outputPath] = [
  "production",
  path.join(__dirname, "mese.config.js"),
  path.join(__dirname, "dist"),
];
const config = getWebpackConfig({ mode, meseConfigUrl, outputPath });
builder.build(config, function (err, stats) {
  // TODO 处理
});

builder.watch

const path = require("path");
const builder = require("@mese/builder");
const [mode, meseConfigUrl, outputPath] = [
  "production",
  path.join(__dirname, "mese.config.js"),
  path.join(__dirname, "dist"),
];
const config = getWebpackConfig({ mode, meseConfigUrl, outputPath });
builder.watch(config, (err, stats, watching) => {
  // TODO 处理
});

Links

处理错误和 stats 对象,阅读下面的文档,