News for hackers. Stuff that matters.
Re:Show HN: JohnnyDepp – A tiny dependency manager for moder... by spankalee on Wednesday October 03, 2018 @12:43PM (#18132069)
Please no. Write standard modules. Serve standard modules to modern browsers, optionally bundling to modules for production. Bundle to non-modules for legacy browsers.

Then we can all eventually move forward from this mess of non-standard module formats and loaders.

Re:Show HN: JohnnyDepp – A tiny dependency manager for moder... by dang on Wednesday October 03, 2018 @04:47PM (#18134693)
It's fine to raise a concern or ask a question about it, but please don't be snarky about it. That's against the rules, both for Show HNs and for the site as a whole.

https://news.ycombinator.com/showhn.html

https://news.ycombinator.com/newsguidelines.html

Re:Show HN: JohnnyDepp – A tiny dependency manager for moder... by spankalee on Thursday October 04, 2018 @06:54PM (#18144405)
Honest question - where was the snark? Am I not allowed to think the current situation is a mess?
Re:Show HN: JohnnyDepp – A tiny dependency manager for moder... by dang on Friday October 05, 2018 @01:54AM (#18145989)
Responding to someone's work with "Please no" seems snarky to me. Certainly it's rude—especially in a Show HN thread, which is all about someone sharing their own work.

https://news.ycombinator.com/showhn.html

Re:Show HN: JohnnyDepp – A tiny dependency manager for moder... by crescentfresh on Wednesday October 03, 2018 @04:16PM (#18134423)
One thing that really sours me in esm is that this is possible (fictional main.js):

    import Vue from 'vue'
    import jQuery from 'jquery'
    global.jQuery = jQuery // to get the next line to 
    work
    import Bootstrap from 'bootstrap'
    import 'bootstrap/dist/css/bootstrap.css'
Then my head explodes. Why would importing a .css file from my JavaScript ever be a thing supported by any tooling. What is that line trying to communicate? What does it even mean to my current scope? (hint: nothing)

import became a giant "do something cool on this line" that maybe the tooling you're using knows how to translate via (say) a webpack loader.

For anyone wondering, that line gets translated to the browser dynamically including css on the page.

Re:Show HN: JohnnyDepp – A tiny dependency manager for moder... by spankalee on Thursday October 04, 2018 @06:58PM (#18144422)
Importing CSS is not supported, at least yet.
Re:Show HN: JohnnyDepp – A tiny dependency manager for moder... by asdkhadsj on Wednesday October 03, 2018 @01:17PM (#18132440)
What are "standard modules" for modern browser? I don't typically frontend dev these days, so I'm likely a bit out of the loop.

The way I typically thought of dependencies with browsers was to bundle them all together. Is there some new solution to this problem?

Re:Show HN: JohnnyDepp – A tiny dependency manager for moder... by mhd on Wednesday October 03, 2018 @01:23PM (#18132493)
Probably using the ES2015 import syntax[1], which allows you to dynamically load modules. I have my doubts whether your average medium+ sized JS app will be that dynamically, so you'll probably end up slurping a whole lot o' module at startup. And without tree-shaking, more stuff to download and digest.

[1]https://caniuse.com/#feat=es6-module-dynamic-import

Re:Show HN: JohnnyDepp – A tiny dependency manager for moder... by spankalee on Thursday October 04, 2018 @06:56PM (#18144413)
You can bundle modules together so you don't have a ton of downloads, but the basic module graph will at least be loadable. WebPackaging will also help in the future.
Re:Show HN: JohnnyDepp – A tiny dependency manager for moder... by sephware on Wednesday October 03, 2018 @01:22PM (#18132489)
They’re still mainly bundlers for now, such as webpack. But browsers are slowly adopting first class modules which has already been solidified by the spec afaik.