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

Accessing Webpack Hash On Server #1366

Closed
valeeum opened this issue Jul 20, 2017 · 2 comments
Closed

Accessing Webpack Hash On Server #1366

valeeum opened this issue Jul 20, 2017 · 2 comments

Comments

@valeeum
Copy link

valeeum commented Jul 20, 2017

Similar to the following issue (#59), i'd like to create a polling mechanism in the Layout component that will hit a graphql service for the hash string created by webpack. If the component detects that a new version is available, it would prompt the user to reload the page. So my question is how would one be able to refer to this hash on the server side of the app?

@ucay
Copy link

ucay commented Aug 17, 2017

Please have a look at this.
You can create webpack's stats (json format) after compiling.

$ webpack --profile --json > compilation-stats.json
$ #or
$ ./node_modules/webpack/bin/webpack.js --profile --json > compilation-stats.json

Then you'll get the result in json.
eg:

{
  "version": "1.4.13", // Version of webpack used for the compilation
  "hash": "11593e3b3ac85436984a", // Compilation specific hash
  "time": 2469, // Compilation time in milliseconds
  "other fields..." : "goes here.."
}

@valeeum
Copy link
Author

valeeum commented Aug 17, 2017

that's exactly what i'm looking for, thank you!

@valeeum valeeum closed this as completed Aug 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants