Giter Site home page Giter Site logo

linebreaker / systemjs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from systemjs/systemjs

0.0 1.0 0.0 8.89 MB

Dynamic ES module loader

License: MIT License

JavaScript 97.49% HTML 2.27% TypeScript 0.13% CoffeeScript 0.02% CSS 0.02% WebAssembly 0.07%

systemjs's Introduction

SystemJS

Build Status Gitter Support Sponsor

Configurable module loader enabling dynamic ES module workflows in browsers and NodeJS.

SystemJS 0.20 release notes

SystemJS is currently sponsored by Canopy Tax.

Built with the ES Module Loader project, which is based on principles and APIs from the WhatWG Loader specification, modules in HTML and NodeJS.

Supports IE9+ provided a promises polyfill is available in the environment.

For discussion, join the Gitter Room.

Documentation

Basic Use

Browser Development

<script src="systemjs/dist/system.js"></script>
<script>
  SystemJS.import('/js/main.js');
</script>

The above will support loading all module formats.

To load ES6 code with in-browser transpilation, one of the following transpiler plugins must be configured:

Browser Production

When all modules are already transpiled into the System.register module format (which can be output via Babel or TypeScript through any build workflow), a production-only loader can be used:

<script src="systemjs/dist/system-production.js"></script>
<script>
  SystemJS.import('/js/main.js');
</script>

Configuration support in the production loader includes baseURL, paths, map, contextual map, bundles and depCache.

NodeJS

To load modules in NodeJS, install SystemJS with:

  npm install systemjs

If transpiling ES modules, install the transpiler plugin following the instructions from the transpiler project page.

We can then load modules equivalently in NodeJS as we do in the browser:

var SystemJS = require('systemjs');

// loads './app.js' from the current directory
SystemJS.import('./app.js').then(function (m) {
  console.log(m);
});

To import a module with the NodeJS module resolution, import with import moduleName from '@node/module-name'.

Running the tests

  npm run build && npm run test

License

MIT

systemjs's People

Contributors

guybedford avatar peteruithoven avatar josh avatar matthewp avatar probins avatar fictitious avatar justinbmeyer avatar meomix avatar stefanr avatar vladima avatar matthewbauer avatar unional avatar majorbreakfast avatar majhork avatar blink1073 avatar simonykq avatar briandipalma avatar b-strauss avatar casperlamboo avatar orkon avatar theefer avatar munter avatar asapach avatar blittle avatar crisptrutski avatar colmbrady avatar jayphelps avatar joeldenning avatar jpiv avatar mikaelkaron avatar

Watchers

James Cloos 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.