Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix optimize-stats task #774

Merged
merged 1 commit into from
May 4, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/electrode-archetype-react-app/arch-clap.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can main be a string?

"main": "web.js?h=11593e3b3ac85436984a",

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no

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.",
Expand Down