Dynamic load module on demand
npm install @21epub/dynamic-loader> Dynamic load module on demand for epub
   
Dynamic module loader to import module for webpack
TODO: Dynamic js or css loader
- [x] Easy-to-use
- [x] Loader for webapck module
- [ ] Loader for online js or css
``bash`
npm install --save @21epub/dynamic-loader
`ts
import { DynamicModuleLoader } from '@21epub/dynamic-loader'
const loaders = [
{
modules: ["module1", "module2"],
loader: async () => {
await import('url/to/module1');
await import('url/to/module2')
}
},
{
modules: 'module3',
loader: async () => {
await import('url/to/module3');
}
}
]
const dynamicLoader = new DynamicModuleLoader(loaders)
...
dynamicLoader.loadAll().then( callbacks => console.log(callbacks))
`
First install dependencies and then install peerDeps for parcel dev:
`sh`
npm install
npm run install-peers
To run Example in hot module reloading mode:
`sh`
npm start
To create a bundle library module build:
`sh`
npm run build
Open the file dist/index.html in your browser
To run unit tests:
`sh``
npm test
MIT © 21epub