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

Bundle analyzer in server mode crashes when running webpack in --watch mode #37

Closed
akatechis opened this issue Jan 10, 2017 · 7 comments

Comments

@akatechis
Copy link

Issue description

I'm using webpack in watch mode, and the bundle analyzer to analyze/serve the analysis in browser. The initial run works great, but when I modify a file, the bundle analyzer causes the process to crash with the following error:

events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE :::8888
    at Object.exports._errnoException (util.js:1022:11)
    at exports._exceptionWithHostPort (util.js:1045:20)
    at Server._listen2 (net.js:1262:14)
    at listen (net.js:1298:10)
    at Server.listen (net.js:1376:9)
    at Function.listen (C:\project\node_modules\express\lib\application.js:617:24)
    at Object.startServer (C:\project\node_modules\webpack-bundle-analyzer\lib\viewer.js:58:14)
    at BundleAnalyzerPlugin.startAnalyzerServer (C:\project\node_modules\webpack-bundle-analyzer\lib\BundleAnalyzerPlugin.js:94:12)
    at C:\project\node_modules\webpack-bundle-analyzer\lib\BundleAnalyzerPlugin.js:60:24
    at C:\project\node_modules\webpack-bundle-analyzer\lib\BundleAnalyzerPlugin.js:72:20
    at Array.forEach (native)
    at Immediate.<anonymous> (C:\project\node_modules\webpack-bundle-analyzer\lib\BundleAnalyzerPlugin.js:71:19)
    at runCallback (timers.js:651:20)
    at tryOnImmediate (timers.js:624:5)
    at processImmediate [as _immediateCallback] (timers.js:596:5)

Looks like it's trying to create a new server with the same port to host the file.

Technical info

  • Webpack Bundle Analyzer version: 2.2.1
  • Webpack version: 2.2.0-rc.3
  • Node.js version: 7.3.0
  • npm/yarn version: 4.0.5 / 0.18.1
  • OS: Windows 10 Home version 1607 (Running commands in Git Bash terminal)

Debug info

How do you use this module?
As a plugin in my webpack.config.js file

If plugin, what options were provided?

const bundleAnalyzerPlugin = new BundleAnalyzer({
  analyzerMode: "server",
  analyzerPort: 8888,
  openAnalyzer: true,
  generateStatsFile: true,
  statsFilename: "build.stats.json",
  statsOptions: null,
  logLevel: "info"
});

What other Webpack plugins were used?
"html-webpack-plugin": "^2.26.0"

@valscion
Copy link
Member

Yes, seems like the server mode tries to restart the server when it is already complete.

Using a --watch mode is currently unsupported.

@nashwaan
Copy link

+1
I hope this great tool will support --watch mode sometime soon.

@th0r
Copy link
Collaborator

th0r commented May 11, 2017

@nashwaan @akatechis Could you guys explain your use cases? Why do you need it to support watch mode? Do you want it to dynamically update treemap according to the changes you made to the sources?

@nashwaan
Copy link

Do you want it to dynamically update treemap according to the changes you made to the sources?

Exactly.

@akatechis
Copy link
Author

Yes, it would be nice to leave the plugin enabled, and use the bundle analyzer at will. As it stands, I have to stop my WDS, insert the plugin, start the server, use the analyzer to see the changes, then stop, remove it, restart WDS, and continue my dev workflow.

@th0r th0r mentioned this issue May 12, 2017
@th0r th0r closed this as completed in #74 May 12, 2017
@th0r
Copy link
Collaborator

th0r commented May 12, 2017

Support for watch mode and Webpack Dev Server landed in v2.8.0

@nashwaan
Copy link

Thanks @th0r for adding the support for watch mode.
👍👍👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants