1.0.1 ā€¢ Published 3 years ago

systemjs-unpkg v1.0.1

Weekly downloads
16
License
MIT
Repository
github
Last release
3 years ago

systemjs-unpkg Latest version Monthly downloads Install size Bundle size

Auto-resolve bare specifiers in SystemJS using UNPKG.

Before

<script type="systemjs-importmap">
{
  "imports": {
    "lodash/": "//unpkg.com/lodash/",
    ...
  }
}
</script>
// Won't work unless the import map above is declared
const _ = await System.import('lodash');

AfterāœØ

// Automatically resolved without import map!
const _ = await System.import('lodash');

You can also specify npm semver ranges and tags

const $ = await System.import('jquery@2.2.4');

const $ = await System.import('jquery@^2.2.4');

const d3 = await System.import('d3@next');

Here's a starter CodePen template to get you started!

If you like this project, please star it & follow me to see what other cool projects I'm working on! ā¤ļø

šŸ™‹ā€ā™‚ļø Why?

  • āš”ļø Simplify SystemJS setup Zero config setup to seamlessly resolve arbitrary bare specifiers with versions!
  • šŸ”„ Import map fallback Only resolves specifiers that aren't defined in your import map!
  • šŸ„ Tiny Only 338B!

šŸš€ Install

npm i systemjs-unpkg

šŸš¦ Quick Setup

Simply load systemjs-unpkg after you load SystemJS.

If you're using a JS bundler:

// Load systemjs
import 'systemjs';

// Load the systemjs AMD extra, as most npm packages have UMD/AMD distributions
import 'systemjs/dist/extras/amd';

// Load systemjs-unpkg
import 'systemjs-unpkg';

If in a browser:

<!-- Load systemjs -->
<script src="//unpkg.com/systemjs/dist/system.min.js"></script>

<!-- Load the systemjs AMD extra, as most npm packages have UMD/AMD distributions -->
<script src="//unpkg.com/systemjs/dist/extras/amd.min.js"></script>

<!-- Load systemjs-unpkg -->
<script src="//unpkg.com/systemjs-unpkg"></script>