question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'react-static build' fails when bundleAnalyzer is true

See original GitHub issue

Reproduce

  1. react-static create
  2. select the basic template and enter
  3. set bundleAnalyzer:true in static.config.js
  4. yarn build

then, errors can be seen in the console

$ react-static build

=> Copying public directory...
=> [✓] Public directory copied: 1.283ms
=> Building Routes...
=> [✓] Routes Built: 748.612ms
=> Bundling App...
Webpack Bundle Analyzer is started at http://127.0.0.1:8888
Use Ctrl+C to close it
=> [✓] App Bundled: 5106.728ms
events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE 127.0.0.1:8888
    at Object._errnoException (util.js:1024:11)
    at _exceptionWithHostPort (util.js:1046:20)
    at Server.setupListenHandle [as _listen2] (net.js:1351:14)
    at listenInCluster (net.js:1392:12)
    at doListen (net.js:1501:7)
    at _combinedTickCallback (internal/process/next_tick.js:141:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
error Command failed with exit code 1.

react-static version: 4.8.1 node version: 8.9.4 Webpack Bundle Analyzer seems to run twice.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
rileylnapiercommented, Jan 11, 2018

i ran into this previously. we should only be doing bundle analyzer when stage === ‘prod’ ~ since stage === ‘node’ doesn’t matter so much.

should be

config.bundleAnalyzer && !isNode ? new BundleAnalyzerPlugin() : null

im in a fork right now, i’ll update it

0reactions
blinkcatcommented, Jan 24, 2018

sorry, I was so busy these days. I found that I could solve the problem by changing the analyzerMode of BundleAnalyzerPlugin from ‘server’ to ‘static’. so, I close this issue now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Solution: webpack-bundle-analyzer without ejecting. #3518
Ejecting is a real shame for any instance of create-react-app, so I found a way to use webpack-bundle-analyzer without ejecting.
Read more >
Webpack bundle analyzer: Need an appropriate loader to ...
I'm new to webpack and I'm trying to install Webpack Bundle Analyzer on my project and I'm getting this error.
Read more >
Create an Error Boundary for a React App | egghead.io
Uncaught errors in React used to leave your app in a corrupted state, since React ... Analyze a Production JavaScript Bundle with webpack-bundle-analyzer....
Read more >
Command Line Interface - webpack
Build. Run webpack (default command, can be omitted). ... --analyze, boolean, It invokes webpack-bundle-analyzer plugin to get bundle information ...
Read more >
How to use Webpack with React: an in-depth tutorial - Medium
Learn Webpack to create your own configurations for React. Including React Router, HMR, Code Splitting, production configuration and more.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found