-
Notifications
You must be signed in to change notification settings - Fork 15
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
bundling - is it a goal? #3
Comments
Bundling is primarily for browsers, and secondarily for published packages to reduce their reachable entry points. I don’t see the benefit here. Install is a good thing, as is tracking changes per file. Node core has a unique and rare scenario where it commits third party code directly to its repo, which differs from the best practice in the wider ecosystem - it’s conceivable that there could be some benefit to bundling for node, i suppose, but not for many other repos. |
You know, we could also just require users to |
I have to raise you |
#3 (comment) is exactly what I’d expect; why would someone be capable of git clone but not npm install for the initial download? I don’t think offline development is a particularly compelling use case, but if that’s desired, then I’d suggest making a separate repo that can act as an offline registry for all versions of deps that node has ever relied on - it’d require a bit more setup for the edge case of offline dev, but it’d let the common case mirror the rest of the ecosystem. |
Regardless of node core internals, I think support bundling of CLI tools is a interesting use case. It guarantees a shorter startup for them, as the load time of Node.js grows with the numbers of js files loaded. Note that the install time is not a good argument, as bundledDependencies can achieve the exact same thing. |
Bundling of CLI tools works fine when there’s static requires; requires to node_modules, core modules, and dynamic requires would just be left untouched. The challenge is programmatically knowing which files you can delete, after. |
I'd like to see actual benchmarks for tools (like yarn's?) before we make any performance claims about the merits or lack thereof of bundling. In my experience trying this with bluebird the impact is really marginal. I can see the value of doing this for simplicity (single file) regardless. |
I wrote this point (5) with a question mark. I would assume performance will vary on a case by case basis. |
I've abused Rollup to bundle Node.js packages for deployment to cloud function providers... it's a good alternative to uploading a zip file, that's for sure. Assuming there are clear benefits, and deferring any question of priority, we need to answer this question: What can Node.js core do--if anything--to make it easier to bundle a Node.js program? |
ESM and how we implement loaders will significantly affect how bundlers can
work with Node (hopefully in a very positive way). We also have an
opportunity with new technologies to re examine this relationship...
Whether it be a binary ast, a V8 memory snapshot, or a combination of lots
of modules and the PRPL pattern... Lots of exciting things node can do to
improve cold boot time.
…On Mon, Sep 10, 2018, 1:31 PM Christopher Hiller ***@***.***> wrote:
I've abused Rollup to bundle Node.js packages for deployment to cloud
function providers... it's a good alternative to uploading a zip file,
that's for sure.
Assuming there are clear benefits, and deferring any question of priority,
we need to answer this question:
What can Node.js core do--if anything--to make it easier to bundle a
Node.js program?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#3 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAecVzw6hjWN1874ep-UDhqasFQglYYbks5uZqHbgaJpZM4WeAlt>
.
|
@boneskull Functions as a Service are probably an excellent use case for this exact kind of thing. Also I'm guessing that there could be some interest from individuals who are shipping Docker images, though that can be done relatively easily already with Dockerfiles. Would be curious to see what – if any – improvements we could make to that flow? There are also tools like pkg that do an interesting job and provide an atypical deployment experience for Node.js applications. |
There are quite a few tools like |
Speeding up Node.js' boot time seems like its own goal; userland bundlers are just one use case that'd see a major impact. Re-packaging the runtime ( @bnb I don't understand how people use Node w/ Docker in the real world; maybe you could expand on what you mean? Maybe it's best at this point to actually ask people working on bundlers what they think. 😄 |
I also wanted to mention "native source map support" |
@lukastaegert (Rollup) and @sokra / @TheLarkInn (Webpack) As a bundling tool author, what features are missing from Node.js that'd make improve your tool, reduce friction for your users, or improve your workflow? Any other notable bugs or pain points? I don't know of any other tools to bundle Node.js apps. @devongovett does Parcel do this? |
One approach is hooking the FS into an archive a la electron and asar. |
does Yarn Plug'n'Play yarnpkg/rfcs#101 change the approach to bundling at all? |
I don't think Plug'n'Play affects that - the static map we generate doesn't have to map to actual file on the filesystem, it also can reference virtual ids. I've actually experimented with loading files directly through zip archives, and it already works quite well (we initially went with the asar format that @refack mentioned, but the lack of support in third-party tools was annoying; zip had the characteristics we needed and is an ubiquitous file format with production-ready libraries like
Checking-in the dependencies in the repository is the direction we're taking with Yarn. The long-term vision is for Yarn to become a developer tool only; you would run it when you want to add/remove dependencies, or manage your workspaces, etc, but never on production (at least by default; we'll never remove This would finally give perfect guarantees that What You See In Dev Is What You Get In Prod, make branch switching much faster, safer, and smarter (since you wouldn't have to run So even if top-level bundling isn't something needed strictly speaking, I think some kind of bundling support (possibly an interface without implementation that third-party plugins could then implement) will help a lot to make the ecosystem more mature. |
Continued from nodejs/node#22722 (comment):
Perceived benefits:
The text was updated successfully, but these errors were encountered: