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
Fix production build and default to it #6839
Conversation
Thanks for making a pull request to JupyterLab! To try out this branch on binder, follow this link: |
Personally, I think this is a fine idea. However, the decision to make Can some who does know why |
It was switched to default to dev mode for not-particularly-great reasons. Primarily, dev mode requires less resources and has shorter build times. This was particularly relevant to repos used in mybinder.org, which would often crash due to hitting RAM limits. The alternative would be to communicate very well to binder users and developers that they may want to build in dev mode. |
@ian-r-rose Okay, so currently for everyone (extension devs, binder users, end-users who install an extension) we're always doing dev mode builds, right? Is there any category of user that would benefit from the If not, then there's a clear solution: we default In terms of naming this is somewhat convoluted (ie a |
Pre-1.0 |
With minimization disabled (what this PR does), I can't see any difference in build time between dev and prod mode on my laptop. They both take around 13s.
End-users would greatly benefit from Webpack production mode since it defines the environment variable
That would defeat the purpose of the production mode explained above.
👍 |
If I remember correctly, there was also an issue that production builds:
I might be misremembering though. Please do a bit of digging in the repo and look for previous discussions. I would do it myself but I'm on mobile only for the rest of the week. |
Yes, the primary reason is memory. We worked around the Windows path issue: https://github.com/jupyterlab/jupyterlab/blob/master/dev_mode/webpack.prod.config.js#L23 |
I did some tinkering and some memory profiling with the build system. Here's the most interesting results (OSX 14.4, 16 GB ram):
|
The minification provided by
On the fancier side of things, we could also do stuff like trigger dev builds for |
I like the idea of using dev as the default if there are any local packages at all. 👍 to the rest of your points @telamonian |
Note: It might be that the memory issues were with the old Uglify plugin, and that with the Terser plugin this is resolved. |
@blink1073 The question will be how to robustly detect that. The |
I meant the local_extensions metadata in build_config.json. https://jupyterlab.readthedocs.io/en/stable/user/extensions.html#settings |
As it turns out, I did end up drawing the data from jupyterlab/jupyterlab/commands.py Lines 477 to 485 in cd5e119
I added a couple of commits to this PR that:
Regrettably (sorry @tibdex), it required a force push, but I fixed it. |
dev_mode/package.json
Outdated
@@ -4,8 +4,11 @@ | |||
"private": true, | |||
"scripts": { | |||
"build": "webpack", | |||
"build:dev": "jlpm run build", | |||
"build:dev:minimize": "jlpm run build:dev", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this actually do a dev build with minimization turned on?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the minimize
there is like a no-op: jlpm build:dev:minimize
will just call jlpm build:dev
. I included it
- A. to help simplify the semantics of handling multiple options, especially if we ever add another one beyond
build-dev
andminimize
- B. as a placeholder, in case someone comes up with a good reason why a minified dev build should exist
Thanks for your changes @telamonian. I agree with the new logic to decide whether to minify or not. LGTM! |
@blink1073 Does the current state of the PR look good to you? |
After a rebase I think the logic looks good. Let’s wait until master is at 1.1dev to merge since this is a cli change |
Arg. My gitfu is weak when it comes to different branch names on local and remote. I managed to push my local Since I no longer have permission to push to EditNew PR at #6907 |
Ah, yeah, maintainers can’t rebase on someone’a master branch |
References
Code changes
The changes are small an explained in comments and in the commit messages.
User-facing changes
End-users will have a better UX since they will be running optimized code.
Backwards-incompatible changes
There should be none as switching to prod build by default is non breaking and Webpack is an implementation detail.