Giter Club home page Giter Club logo

charto-loader's Introduction

charto-loader

This is the most awesome JavaScript / TypeScript module loader. It combines the superpowers of:

  • SystemJS for in-browser development without any tooling.
  • cresolve for fully automatic configuration using Node.js module resolution.

Features

  • Looks for node_modules and inside, in the same places Node.js would.
  • Automatic UNPKG fallback when a package is not yet installed.
  • Handles browser mappings in package.json files.
  • Transpiles ES6 using TypeScript compiler (by default).
  • Generates SystemJS configuration JSON to easily eliminate dependency on this library and switch to vanilla SystemJS.

Usage

Import a main App.ts file from HTML like this:

<script src="//unpkg.com/charto-loader@1/loader.min.js"></script>
<script>

charto.initSystemTS(function() {
	System.import('./App.ts');
});

</script>

You can write ./src/App (.ts or .tsx extension is added) or ./dist/App (.js extension is added) instead. If your project is not TypeScript (but why?), use charto.initSystem and add a first argument with a SystemJS configuration object or configuration file address, setting up a transpiler if necessary.

It loads core-js if Promise support is missing (mainly in IE 11) and SystemJS from a CDN or under node_modules if present. cresolve is included in the loader bundle.

loader.min.js is the minified version, loader.src.js is for debugging without minification.

To print the auto-generated SystemJS configuration, use:

import charto from 'charto-loader';

console.log(JSON.stringify(charto.systemConfig, null, '\t'));

License

The MIT License

Copyright (c) 2018- BusFaster Ltd

charto-loader's People

Contributors

jjrv 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.