Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | import chalk from 'chalk' import { spawn } from 'child_process' import * as log from 'fancy-log' import * as fs from 'fs' import { ITimplaTask, projectDestPath } from '../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) */ export const openAnalyzer: ITimplaTask = ({ javascripts: jsOptions }) => cb => { if (!jsOptions.webpackBundleAnalyzerOptions) { return cb } const file = projectDestPath(jsOptions.dest, jsOptions.webpackBundleAnalyzerOptions.statsFilename) if (fs.existsSync(file)) { spawn('npx', ['webpack-bundle-analyzer', file], { stdio: 'inherit' }) cb() } else { log( chalk.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() } |