@pandino/loader-configuration-dom
v0.8.31
Published
Bundle loading configuration for the DOM
Downloads
11
Readme
loader-configuration-dom
This package is a first-party default Pandino loader configuration.
Usage
Obtain the library from a CDN or NPM (@pandino/loader-configuration-dom
). Import it, and provide it to the Pandino
constructor argument.
import loaderConfiguration from 'https://unpkg.com/@pandino/loader-configuration-dom/dist/loader-configuration-dom.mjs';
import Pandino from 'https://unpkg.com/@pandino/pandino/dist/esm/pandino.mjs';
const pandino = new Pandino({
...loaderConfiguration,
// other properties may go here
});
await pandino.init();
await pandino.start();
Behaviour
Determining the "base" URL for Activator file loading based on manifest file location:
- if the manifest file's path starts with
http
, then the base path of the manifest URL's head (ending at the last/
) will be used - in every other case it will take the Browser's
location.origin
, appends the value set in theìndex.html
's<base href="...">
(if present, otherwise will fall back to/
)
and lastly append whatever path is set in the manifest's Bundle-Activator
property.
Example:
| index.html URL | base-href | Manifest file fetch() URL | Activator path in Manifest | Calculated JS URL |
|------------------------|------------|------------------------------------|----------------------------|------------------------------------------|
| http://host.com | - | http://lib.to/bundle-manifest.json | ./bundle.mjs
| http://lib.to/bundle.mjs |
| http://host.com/my-app | - | http://lib.to/bundle-manifest.json | ./bundle.mjs
| http://lib.to/bundle.mjs |
| http://host.com | - | ./bundle-manifest.json | ./bundle.mjs
| http://host.com/bundle.mjs |
| http://host.com/my-app | - | ./bundle-manifest.json | ./bundle.mjs
| http://host.com/bundle.mjs |
| http://host.com | /
| ./bundle-manifest.json | ./bundle.mjs
| http://host.com/bundle.mjs |
| http://host.com/my-app | /my-app/
| ./bundle-manifest.json | ./bundle.mjs
| http://host.com/my-app/bundle.mjs |
| http://host.com | /
| ./deploy/bundle-manifest.json | ./bundle.mjs
| http://host.com/deploy/bundle.mjs |
| http://host.com | /my-app/
| ./deploy/bundle-manifest.json | ./bundle.mjs
| http://host.com/my-app/deploy/bundle.mjs |
License
Eclipse Public License - v 2.0