44 comments

[ 2.7 ms ] story [ 76.9 ms ] thread
Hi Everyone - author here. I just wanted to give you some background on the project. JohnnyDepp came out of a feature request I got on another project called LoadJS (https://github.com/muicss/loadjs) which is an async loading library. The request was for a higher-level dependency manager that:

  1. lazy-loads files
  2. handles JS/CSS/images
  3. handles nested dependencies
  4. makes it easy to manage dependencies among team members
  5. is extremely lightweight
I realize that many teams use RequireJS to manage dependencies but I saw an opportunity to make a library that could accomplish many of the same things but with a much smaller footprint and a simpler API. I hope you'll give it a try and let me know what you think!
Have you looked into <script type=module>?

When you use that, you have dependency management supported by the browser natively.

In that light, are custom dependency loaders still needed?

Thanks for the recommendation! I wasn't aware of the modules feature or that it was already supported in Chrome/Safari/Firefox/Edge. I'll take a closer look at modules but if you're only targeting edge browsers then maybe you can do dependency management purely natively.
I remember using this 8 years ago. Lazy loading is awesome and way to go!
Is he cool with using his name and likeness?
Yes
Out of curiosity, how did you go about obtaining permission?
Can you prove this? People could easily run into legal issues if they want to use this and it turns out he didn't grant the use of his name.
How's Johnny really managing his dependencies?
Given his behavior over the years: not well.
Maybe you should name this JohnnyDep so it's more an allusion and less the actual person's name? Dep makes more sense anyways, as dependency has one p.
Extending the subtlety vector a little more:

"Johnny"

Or perhaps `JonnyDep` or `JonnyDeps`. A whimsical allusion to someone else can be playful and respectful.

But to appropriate someone else's full exact name for another purpose is kind of rude – especially if that person makes their living from their public image/name.

I really don't understand modern web development. If people would build websites without shit, they wouldn't need stuff like this.
That's not for building simple static websites or simple blogs. That's for when you build a web application. Think Slack client, gmail, Jira, etc.
The web as a "document only" medium is long gone. However where I would slightly agree with you is new sites that could have a simple interface loading tonnes of JS. But for business apps delivered over the web, yes we need tooling to tame JS.
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.

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?

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.
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

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.
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.

Importing CSS is not supported, at least yet.
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

Honest question - where was the snark? Am I not allowed to think the current situation is a mess?
…why would you name this after a domestic abuser?
It's named after a great actor.
Who just so happens to be a domestic abuser, so...
So I read, but that doesn't detract from his acting ability, which is presumably why his name is being used for this project.
Agreed, this is an uncomfortable name.
Do you take similar issue with the framework Sinatra?
Sinatra's dead. Depp is a real, living actor and the value of his name directly affects his current net worth. Glorifying him, therefore, is different than doing the same for Sinatra.
(comment deleted)
Nothing beats my dependency manager, which I'll just call DrGonzo:

  var exports = {};
  function require(modname) {
    if (modname == 'jquery') return $;
    else if (modname.startsWith('.')) return exports;
    else { console.log("Unknown require()", modname); return exports; }
  }
(Of course you've gotta <include> the modules ahead of time -- I actually use this for http://8bitworkshop.com/)