
Show HN: JohnnyDepp – A tiny dependency manager for modern browsers in 862 bytes - andres
https://github.com/muicss/johnnydepp?a=1
======
o_____________o
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.

~~~
dboreham
Extending the subtlety vector a little more:

"Johnny"

~~~
quickthrower2
or "Jack"

~~~
dboreham
The config would be what you might call "guidelines".

------
andres
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](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!

~~~
TekMol
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?

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

------
MaxGabriel
This is without doubt the worst dependency manager I have ever heard of.

~~~
hnbroseph
what qualities do you feel make it so?

~~~
MaxGabriel
It’s a quote from Pirates of the Caribbean, about the character Johnny Depp
played:

[https://youtu.be/wv9PWo-KLc0](https://youtu.be/wv9PWo-KLc0)

[https://youtu.be/CAt5JB96Cdk](https://youtu.be/CAt5JB96Cdk)

------
LinuxBender
Is he cool with using his name and likeness?

~~~
andres
Yes

~~~
UweSchmidt
Out of curiosity, how did you go about obtaining permission?

------
sehugg
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/](http://8bitworkshop.com/))

------
shanghaiaway
How's Johnny really managing his dependencies?

~~~
jarcane
Given his behavior over the years: not well.

------
Boulth
Cool, reminds me of this [0], it's 850 chars before gzipping.

[0]: [https://curiosity-driven.org/minimal-loader](https://curiosity-
driven.org/minimal-loader)

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

~~~
asdkhadsj
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?

~~~
mhd
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](https://caniuse.com/#feat=es6-module-dynamic-import)

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

------
mjg59
…why would you name this after a domestic abuser?

~~~
faitswulff
Agreed, this is an uncomfortable name.

~~~
np_tedious
Do you take similar issue with the framework Sinatra?

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

------
jaequery
nice name!

------
sdx23
I really don't understand modern web development. If people would build
websites without shit, they wouldn't need stuff like this.

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

