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

No way to have a callback after build completes #132

Closed
natew opened this issue Mar 14, 2015 · 4 comments
Closed

No way to have a callback after build completes #132

natew opened this issue Mar 14, 2015 · 4 comments

Comments

@natew
Copy link

natew commented Mar 14, 2015

I expected the callback when running listen to happen after the build was complete, but instead it calls right after. Any recommendation for having a hook that runs after the build?

I'd like to output stats on how long it took to build in the console.

@sokra
Copy link
Member

sokra commented Mar 25, 2015

var compiler = webpack(...);
compiler.plugin("done", function() { ... });
new WebpackDevServer(compiler, ...

@natew
Copy link
Author

natew commented Mar 25, 2015

Nice, thank you. I tried this, but now it does this:

build took 12154ms
Your build is complete.
Note: If you see a warning about your routes, this is ok!
We do dynamic requires that causes Webpack to output this error
Hash: 8e732e1dd38dc1252ce6
Version: webpack 1.7.0
Time: 12088ms
       Asset     Size  Chunks             Chunk Names
 sunrise.jpg    61778          [emitted]  
   river.jpg    35232          [emitted]  
  winter.jpg    30584          [emitted]  
yosemite.jpg    93280          [emitted]  
     main.js  1703306       0  [emitted]  main
chunk    {0} main.js (main) 1508450 [rendered]
...

I guess I can do a setTimeout, but is there a cleaner way to hook in so I can output that stuff after the build stats?

@natew
Copy link
Author

natew commented Mar 25, 2015

The setTimeout seems to work alright for now.

@amerllica
Copy link

@sokra ,Thanks for your pretty answer.

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

3 participants