GithubHelp home page GithubHelp logo

privatenumber / systemjs-unpkg Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 0.0 107 KB

SystemJS extra to auto-resolve bare specifiers to UNPKG

License: MIT License

JavaScript 100.00%
systemjs extra unpkg auto resolve bare specifier

systemjs-unpkg's Introduction

systemjs-unpkg Latest version Monthly downloads Install size Bundle size

Auto-resolve bare specifiers in SystemJS using UNPKG.

Before

Without this plugin, you have to manually declare individual dependencies in an importmap.

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

After

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

You can also specify npm semver ranges and tags

const $ = await System.import('[email protected]');

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>

systemjs-unpkg's People

Contributors

privatenumber avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.