0.1.2 • Published 6 years ago
rollup-plugin-cdn v0.1.2
rollup-plugin-cdn
Resolve locally all dependencies loaded through fully qualified CDN urls.
Supported CDNs
Following the list of supported CDNs (so far).
- unpkg.com
- rawgit.com (both dev and prod links)
Example
If your module has hyperHTML as dependency, and you have installed it locally, you can import it as fully qualified ESM module.
The remote url will be resolved through the locally installed dependency.
import hyper from 'https://unpkg.com/hyperhtml@latest/esm/index.js';
hyper(document.body)`
<h1>Hello ESM</h1>`;
This enables your modules to be natively testable/usable as ESM in browsers, but also easily bundled for production.
Installation
$ npm install rollup-plugin-cdn
Usage
// rollup.config.js
import cdn from 'rollup-plugin-cdn';
export default {
input: './esm/index.js',
plugins: [cdn()],
};
License
ISC, see LICENSE
for more information.