-
-
Notifications
You must be signed in to change notification settings - Fork 27k
Slow production build #2763
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
Comments
We'll switch to Webpack 3 soon which will be a tad faster. I see you're using code splitting—maybe this could help? webpack/webpack#4636 (comment) I'm not sure how exactly you're using it. Other than that, I don't really have good news for you. You can contribute to webpack to make it faster, or maybe investigate approaches like HappyPack and whether we could switch to them. |
I think we can do more to improve build speed. And then there's @asfktz autodll plugin https://github.com/asfktz/autodll-webpack-plugin/. I haven't tested it with a real project, but it's nice to work with him on improving this :) And at the very least, maybe we can add tests that track how long the build gonna take, with a large number of files. |
Switching this internally would, of course, affects stability, maybe we can have a canary channel to test out this? At least, a canary channel of CRA would have more users than an obscurely published fork. Or have a way to easily install from GitHub branches, without modifying package name etc. In my experience maintaining a fork is hard, especially if I need to modify something that is not in react-scripts. Sometimes when syncing the package name is overwritten, imports are rewritten, etc2 |
How long does |
@Timer |
Most client side code isn't very private, 😛. Is this app deployed on the web so I could take a peek? |
The app is deployed on the web but can only access via a VPN. It's a huge Admin Panel app for an internal product. I could talk to the team to see if I can grant you a read permission, would you still willing to take a look if I can get the agreement from the team? |
Sure! I would love to have temporary access to the code base to test optimizations against. Build speed is something we're very interested in speeding up. |
@viankakrisna uglifyjs plugin now supports parallel out-of-the-box. https://github.com/webpack-contrib/uglifyjs-webpack-plugin/#parallel |
@trungdq88 any word on that repo? 😄 |
@Timer sorry for being inactive. It is under consideration and we need sometime to prepare something like NDA (we have never done this before). Hopefully I can have the answer for you in the next 2 days. |
I'm going to be out of town until next week, just a heads up! So no rush. |
@miraage can we enable it with our current webpack version? |
@viankakrisna it works for me like a charm in my pet project (webpack 3.4). The problem is that plugin currently in beta status. |
We'll hold off on enabling it until it's considered stable. :) |
I wish CRA has an experimental version, just to test cutting edge feature with lots of user and case 😄 |
@viankakrisna yeah I also wouldn't mind having some fork with latest features :D |
It should be promoted "officially" by CRA so more people can test drive it :) |
Nice, thanks for checking! You can also add |
File an issue for this? I'm not opposed to having an opt in way to beta test features before they're enabled for everybody. |
Setting |
Disabling eslint preloader also decreases build time. |
How do you guys disable eslint? |
^ ejecting? found an interesting issue about eslint-loader / eslint perf webpack-contrib/eslint-loader#206 |
@viankakrisna Good find |
Is there no way to disable eslint via an environment variable when building without ejecting? |
Any movement on this? I've got a project where the CRA Build is the overwhelming majority of the time. It's a Maven project - the CRA app is the frontend for a Java webapp. The entire Maven build for my frontend takes 40s, including:
So just building the production frontend files is over 3/4 of the build time. This is using CRA as it comes, with no ejecting or anything like that, and only has 26 source files. |
Installed new CRA@next ( Old setup: New setup: Environment:
I can provide full config difference from default |
The bulk of all optimizations have made it into the 2.0 beta, barring webpack 4. @sidoruk-sv if you're reporting a build time regression, please open a new issue. |
@Timer one more thing) That was my misunderstanding of So tried latest: and re-check build time for old and new configs: Old:
New:
So build time (total/elapsed) decrease by ~10-20s(for my config) You guys are cool! |
Neat. The next 2.0 release will be even quicker, stay tuned! |
I was playing with I'm using loader: () => import(`components/${component}`) to: loader: () => import(/* webpackChunkName: "components/[request]" */ `components/${component}`) and as result: almost in 6x times build time is faster now. Hope it will help somebody. p.s. more info about |
interesting, can that comment be inserted automatically with a babel plugin / other wizardry? |
I can se react-script is using webpack 3 right now, but I feel that it is still slow, do you think we should have automatically build to ignore the waiting time? |
do you solve the build slowly?Thank you! |
Not sure if the project is too large or there is something wrong, but my
yarn run build
took almost 5 minutes.The project is about 1k5 files:
Is it normal? Is there any
--debug
option to verbosely view the time took to compile the project?The text was updated successfully, but these errors were encountered: