News for hackers. Stuff that matters.
Re:Why does a new Rails app need 106 MB of JavaScript? by svnpenn on Wednesday July 01, 2020 @04:05PM (#23705902)
> A lot of other frameworks do the same thing.

God that is an awful justification.

The heading is the opposite of clickbait. 106 MB is not exaggerated, the link provides proof showing that number. I get pretty tired of people handwaving away bloat these days. Its a real problem across programming languages and communities, and it doesnt just go away by pretending it doesnt exist. It goes away by people testing for it, making it a priority for software to be streamlined and pruning bloat where it makes sense.

Re:Why does a new Rails app need 106 MB of JavaScript? by mithr on Wednesday July 01, 2020 @04:18PM (#23706046)
You sort of missed the point. The point isn't "there's 106mb of code that will make it into production, but it's ok because other frameworks do it" -- the point is "looking at the size of the node_modules directory is not remotely representative of the final size of the bundled code that will make it to production, and this is in fact the way many modern frameworks work."

Two concrete examples: first, node_modules contains any development modules, which won't make it into the final code at all. Second, most of these packages are installed into the node_modules directory with typing support, full un-minified code, etc etc. When bundling the app for deployment, much of that goes away.

Re:Why does a new Rails app need 106 MB of JavaScript? by rileytg on Wednesday July 01, 2020 @04:45PM (#23706419)
The issue for me is nuanced. While it doesn't go to end users in production, it still ends up in my heroku buildpack. This sharp increase (33% of my allowed buildpack) was alarming.

Having been a rails and react developer for a very long time, i'm generally aware of the value added by all these files. I bring up these concerns almost to say "have we added too much? is it time to think about trimming back?".

Re:Why does a new Rails app need 106 MB of JavaScript? by johannes1234321 on Wednesday July 01, 2020 @04:28PM (#23706183)
Still it's 106MB which has to be audited, checked for license, ...
Re:Why does a new Rails app need 106 MB of JavaScript? by mithr on Wednesday July 01, 2020 @04:33PM (#23706260)
I don't think anyone's forcing you to use the rails CLI's "new" command to start a new rails project, if you're concerned about all of that and just don't want to deal with it... the docs explicitly say that this is a convenience method for getting started quickly with everything they think a modern developer would want. If you don't want that, that's a perfectly fine choice -- just start a new project from scratch, instead.
Re:Why does a new Rails app need 106 MB of JavaScript? by thrwwy90876 on Wednesday July 01, 2020 @04:16PM (#23706017)
It's build tools. This is like complaining that Xcode is many gigabytes.
Re:Why does a new Rails app need 106 MB of JavaScript? by tedunangst on Wednesday July 01, 2020 @04:19PM (#23706067)
I never had to install a new copy of xcode for every project.
Re:Why does a new Rails app need 106 MB of JavaScript? by pistoriusp on Wednesday July 01, 2020 @04:24PM (#23706141)
So the problem is not the size, but that you want to have a single cache of all the npm modules?
Re:Why does a new Rails app need 106 MB of JavaScript? by pistoriusp on Wednesday July 01, 2020 @04:17PM (#23706040)
And, what about OS X, it takes a huge amount of space... and they install things I never use!

It's almost as if these things run on code!

Re:Why does a new Rails app need 106 MB of JavaScript? by cxr on Thursday July 02, 2020 @12:17AM (#23709972)
These kinds of comments are against HN guidelines FYI.
Re:Why does a new Rails app need 106 MB of JavaScript? by pistoriusp on Thursday July 02, 2020 @01:53AM (#23710407)
You're right, I was not in the best light last evening. My apologies to the community.
Re:Why does a new Rails app need 106 MB of JavaScript? by johannes1234321 on Wednesday July 01, 2020 @04:32PM (#23706247)
Xcode is from a single vendor, whom I trust as much as I trust the operating system.

With rails and npm I probably trust Rails and see them as license-wise ok, but due to version requirements I might get "newer" versions of a package, which hasn't been veted by Rails devs, might use different license, might do stuff I don't want it might add in even other new deps.

Re:Why does a new Rails app need 106 MB of JavaScript? by isochronous on Wednesday July 01, 2020 @04:40PM (#23706358)
Then all you have to do is specify the specific version you want in your package.json, rather than a semver range, and you'll never get a version you haven't explicitly approved.
Re:Why does a new Rails app need 106 MB of JavaScript? by johannes1234321 on Wednesday July 01, 2020 @05:28PM (#23706927)
Of each of the dependencies Rails installs.
Re:Why does a new Rails app need 106 MB of JavaScript? by schwartzworld on Wednesday July 01, 2020 @08:22PM (#23708495)
don't use an opinionated framework then?
Re:Why does a new Rails app need 106 MB of JavaScript? by rileytg on Wednesday July 01, 2020 @04:46PM (#23706440)
I don't upload xcode.app to apple every time i submit an iOS app. I do npm install on every build on heroku.
Re:Why does a new Rails app need 106 MB of JavaScript? by eropple on Wednesday July 01, 2020 @04:49PM (#23706488)
Then maybe don't use Heroku and use something that can work with a finished build?

It's not complicated to set up a build container locally and ship only your final result to a service that can run it.

Re:Why does a new Rails app need 106 MB of JavaScript? by rileytg on Wednesday July 01, 2020 @05:10PM (#23706756)
Heroku provides value in other ways for us. We run on a number of other solutions, most involve shipping a ~100mb image. This can be dramatically reduced in size with a slimmer base image, which we plan on doing eventually.

In this case, heroku handles a lot of things we otherwise need to do ourselves: - DB + backups + DR - Network security - Network routing - SSL certs - Easy scaling of resources - Access control to operations (redeploy, restart etc) - Audits of operations etc

We can do all these things, and under various compliance frameworks, outside of heroku; its just exhausting and expensive. This project we want to focus on the product so we opt for heroku as it was a few lines of bash we were all familiar with to get up and running nearly prod ready.

Re:Why does a new Rails app need 106 MB of JavaScript? by jspash on Wednesday July 01, 2020 @04:55PM (#23706560)
Just build locally and vendor the asset artefacts. That's how we did it in the "good old days". No containers in containers needed.
Re:Why does a new Rails app need 106 MB of JavaScript? by eropple on Wednesday July 01, 2020 @04:58PM (#23706590)
To be clear, you don't do "containers in containers", you build a container and you copy your assets from the other one. You then have a shippable artifact with all your dependencies, including your runtime, vendored into it.

I'm not a k8s guy, but it's a lot nicer than a tarball.

Re:Why does a new Rails app need 106 MB of JavaScript? by gtirloni on Wednesday July 01, 2020 @04:12PM (#23705974)
It's really clickbait. The "proof" provided includes all sorts of crap that the npm packages ship with.

If you want to show how much JS a new Rails project has, show what gets delivered to the frontend not all the trash in node_modules.

Re:Why does a new Rails app need 106 MB of JavaScript? by wzy on Wednesday July 01, 2020 @07:13PM (#23707956)
How is it bloat if 160MB of JavaScript will never be in the production version of the app?

I mean, the Basecamp team just published Hey.com with less the 50KB of JavaScript and their dev build of Rails for that project must've exceeded 160MB in `node_modules`.