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

Server start-up takes too long to boot up. #186

Open
raavanan opened this issue Jun 27, 2016 · 14 comments
Open

Server start-up takes too long to boot up. #186

raavanan opened this issue Jun 27, 2016 · 14 comments
Labels
V2.9.0 Express & server updates
Milestone

Comments

@raavanan
Copy link

I am facing pretty long build times on development mode, around 50-70 seconds.

I could narrow it down to notice that babel-register and babel-polyfill being required takes way too long to execute even a console statement at the start of server.js file. Any suggestions to speed up this process ? Also, i have replaced cssnext with a less loader along with post-css, but i'm guessing that shouldn't be the cause for the performance hit at server side transpiling since i have fewer .less files.

P.S.
I am running npm@3.9.6,, was thinking may be it was related to this post, but doesn't help.

@zatziky
Copy link

zatziky commented Jun 29, 2016

I am experiencing the very same problem with fresh installation of mern-starter. The server boots up aroung 1 minute then every change caught by nodemon takes again about 1 min to restart the server.

@osenvosem
Copy link

Yes, the dev server starts up long time.

@froskie
Copy link

froskie commented Jul 25, 2016

If you check what babel-plugin-webpack-loaders does, you'll see that yes, it'll take a long time to start the server. It comes with a cost, but it's amazingly helpful. If you're working only with frontend, the refresh will be quite simple, but if you going for server folder, each time it has to restart is a real pain.

@qlqllu
Copy link

qlqllu commented Oct 15, 2016

From my investigation, the reason is whenever we start or restart the server, the webpack will rebuild all of the related files, this will take a long time

@qlqllu
Copy link

qlqllu commented Oct 15, 2016

Here is the related issue: #153

@kfrankovic
Copy link

kfrankovic commented Oct 24, 2016

I'm experiencing the same issues here. As the project grows (and it is still not very big currently, no more than 10 screens without much functionality), things are getting even worse - we are now on almost 3 minutes for server startup / every change on the server.
Is there any solution for this issue? What especially worries me how long will build times take six months from now once we have much more code.

@qlqllu
Copy link

qlqllu commented Oct 25, 2016

+1

@kfrankovic
Copy link

20 days later, we are at almost 6:30 for server restart. Build speed is deteriorating fast.

@amygdaloideum
Copy link

@kfrankovic Did you find any solution?

@kfrankovic
Copy link

kfrankovic commented Nov 20, 2016

@amygdaloideum Actually yes, colleague on the project found a solution this week.

If I'm correct, we now have enabled babel caching (removed BABEL_DISABLE_CACHE flag from startup script) and enabled and configured aggressive caching (unsafe cache) in webpack.config.babel.js for webpack, and server start times are now less than 30 seconds (and most of that is actually webpack, which I wasn't even counting before).

The only new issue we experienced so far is that sometimes it fails to load changes in scss files if you don't make change where scss file is referenced, but this is just a small nuisance compared to 'build' times we had before.

I'll tell colleague to post further instructions tomorrow (I don't know all the details, and don't want to grab his credits for finding the solution).

@amygdaloideum
Copy link

@kfrankovic Thank you!

@hhlevnjak
Copy link

hhlevnjak commented Nov 21, 2016

@amygdaloideum

As @kfrankovic noted, we managed to improve build times by adding some caching to babel. We added the following loader to webpack.config.babel.js

{
    test: /\.js$/,
    exclude: /(node_modules)/,
    loader: 'babel?cacheDirectory',
    query: {
      presets: ['es2015']
    }
  }

We also removed the BABEL_DISABLE_CACHE from startup. Even though it's not recommended to do so, there haven't been any side effects that we noted so far. The only one being that sometimes if you edit a css file, the change won't get hot reloaded until you edit the file referencing that css file.

@Eligioo
Copy link

Eligioo commented Mar 29, 2018

@hhlevnjak Can you be more specific where you have added the loader into the webpack.config.babal.js?
I managed to remove the BABEL_DISABLE_CACHE from startup tho.

@hhlevnjak
Copy link

It was just added to the loaders.

Though this was over a year ago, webpack configurations had other problems as well, so we rewrote the whole webpack configuration to match the needs of the project in the meantime.

@mannyhenri mannyhenri added the V2.9.0 Express & server updates label Jun 2, 2018
@mannyhenri mannyhenri added this to To do in MERN Roadmap via automation Jun 2, 2018
@mannyhenri mannyhenri added this to the 2.9.0 milestone Jun 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
V2.9.0 Express & server updates
Projects
MERN Roadmap
  
To do
Development

No branches or pull requests

10 participants