From 2b5c7096f89915330924d55b99002fdd12bfeaf0 Mon Sep 17 00:00:00 2001 From: Joel Chen Date: Fri, 4 May 2018 11:09:00 -0700 Subject: [PATCH] fix optimize-stats task (#774) --- packages/electrode-archetype-react-app/arch-clap.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/electrode-archetype-react-app/arch-clap.js b/packages/electrode-archetype-react-app/arch-clap.js index 5b7c11916..c08cfb624 100644 --- a/packages/electrode-archetype-react-app/arch-clap.js +++ b/packages/electrode-archetype-react-app/arch-clap.js @@ -763,7 +763,11 @@ Individual .babelrc files were generated for you in src/client and src/server }, "optimize-stats": { desc: "Generate a list of all files that went into production bundle JS (results in .etmp)", - task: `analyze-bundle -b dist/js/bundle.*.js -s dist/server/stats.json` + task: () => { + const stats = JSON.parse(Fs.readFileSync("dist/server/stats.json")); + const bundle = stats.assetsByChunkName.main.find(x => x.endsWith(".js")); + return `~$analyze-bundle -b dist/js/${bundle} -s dist/server/stats.json`; + } }, pwa: { desc: "PWA must have dist by running `clap build` first and then start the app server only.",