Skip to content

hipertracker/requirejs-babel

 
 

Repository files navigation

Babel Plugin for RequireJS

A Babel loader plugin for RequireJS.

Installation

npm install hipertracker/requirejs-babel

Usage

Add the paths and shim to configuration:

    paths: {
        babel: 'vendor/requirejs-babel/browser',
        babel_polyfill: 'vendor/requirejs-babel/polyfill.min',
        es6: 'vendor/requirejs-babel/es6'
    },
    shim: {
        babel: {
            deps: ['babel_polyfill']
        }

Reference files via the es6! plugin name:

new ES6 syntax (better)

import MyEs6Module from 'es6!./my-es6-module'

or plain old AMD syntax:

  define(['es6!./my-es6-module'], function(MyEs6Module) {
    // ...
  });
....
<script src="./requirejs-config.js"></script>
<script src="./vendor/requirejs/require.js" data-main="es6!./src/main" ></script>

Credits

Example of React & RequireJS & Babel with ES6+

About

An AMD loader plugin for Babel

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%