jkcfg / jk

Configuration as Code with ECMAScript
https://jkcfg.github.io
Apache License 2.0
406 stars 30 forks source link

Download npm modules on demand #233

Open squaremo opened 5 years ago

squaremo commented 5 years ago

Instead of making people construct npm scaffolding (package.json, package-lock.json, npm-shrinkwrap.json), as in #232 we could just download things from npm when mentioned in an import.

Since we know imports statically, we can do this ahead of time, even. jk import fetch ./index.js

Since third-party modules will not know about this, it has to work with import statements as they are used now -- i.e., we can't require a special syntax. Though possibly we could resolve with respect to a base, so if index.js imports npm://handlebars/lib/handlebars then anything that imports could be relative to npm://. Maybe.

squaremo commented 5 years ago

More thoughts: