lurantis
v0.3.3
Published
bundler as a service; on-demand npm package bundler over http
Downloads
14
Maintainers
Readme
lurantis
An HTTP server that bundles and serves packages from NPM; "bundler as a service."
Usage
Run the server:
npx lurantis --port 8080
Then, send GET requests to it:
curl http://localhost:8080/npm/[email protected]
It'll fetch the package and all its dependencies from npm, bundle it up into a UMD module, and respond with the script:
HTTP/1.1 200 OK
Content-Type: text/javascript;charset=UTF-8
X-Global-Name: _LUR_lodash_4_17_21
(function (global) {
// ...the rest of the response is omitted from this README...
Note the X-Global-Name
header. This indicates the global that the package's exports will be written to when the bundle is loaded as a script in a browser. It won't ever change, but you can check that header
when setting up your script tag, to know what global to look for.
If you want to minify the code, too, add ?minify=true
to the end of the URL:
curl http://localhost:8080/npm/[email protected]?minify=true
License
MIT