ffbt
Version:
Build a Typescript app without pain
28 lines (27 loc) • 937 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.RunWebpackCompileWatcherStrategy = void 0;
const webpack = require("webpack");
const cleanup_1 = require("../../../core/cleanup");
const output_1 = require("../utils/output");
class RunWebpackCompileWatcherStrategy {
constructor(webpackConfig) {
this.webpackConfig = webpackConfig;
}
run() {
const compiler = webpack(this.webpackConfig);
const printStats = output_1.printWebpackStats(this.webpackConfig.stats);
const watcher = compiler.watch({}, (err, stats) => {
if (err === null) {
return;
}
printStats(err, stats);
});
cleanup_1.cleanupIfError(() => {
watcher.close(() => {
console.log(" 👍");
});
});
}
}
exports.RunWebpackCompileWatcherStrategy = RunWebpackCompileWatcherStrategy;