UNPKG

timpla

Version:

An optimal website development experience for [server-side] web frameworks.

29 lines 1.17 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var chalk_1 = require("chalk"); var child_process_1 = require("child_process"); var log = require("fancy-log"); var fs = require("fs"); var internal_1 = require("../internal"); /** * We have to isolate the bundleAnalyzer process in prod * As this blocks the webpack build process (no js files are being output when server / static modes are set) */ exports.openAnalyzer = function (_a) { var jsOptions = _a.javascripts; return function (cb) { if (!jsOptions.webpackBundleAnalyzerOptions) { return cb; } var file = internal_1.projectDestPath(jsOptions.dest, jsOptions.webpackBundleAnalyzerOptions.statsFilename); if (fs.existsSync(file)) { child_process_1.spawn('npx', ['webpack-bundle-analyzer', file], { stdio: 'inherit' }); cb(); } else { log(chalk_1.default.yellow("Whoops - can't seem to find the timpla-webpack-stats.json file. Please check your configs, or if it's your first time, please run timpla build")); } cb(); }; }; //# sourceMappingURL=openAnalyzer.js.map