Skip to content

Webpack loader for Traceur, Google's ES6 to ES5 compiler

License

Notifications You must be signed in to change notification settings

marekmicek/webpack-traceur-loader

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Traceur Loader for Webpack

A Webpack loader for transpiling ES6-compatible code to ES5-compatible code using Google's Traceur compiler.

Installation

npm install webpack-traceur-loader

Usage

Inline

Requiring files inline:

// Simple inline usage
require('webpack-traceur!./src/index');

// More advanced version; include the Traceur runtime
require('webpack-traceur!./src/index?runtime');

Documentation: Using Loaders

Recommended Configuration

In your webpack.config.js file:

module.exports = {
  module: {
    loaders: [
      // Transpile any JavaScript file:
      { test: /\.js$/, loader: 'webpack-traceur' },

      // Or only those with a specific suffix:
      { test: /\.es6\.js$/, loader: 'webpack-traceur' },

      // Include the Traceur runtime:
      { test: /\.es6\.js$/, loader: 'webpack-traceur?runtime' },

      // ...And any other Traceur option you like:
      { test: /\.es6\.js$/, loader: 'webpack-traceur?runtime&sourceMaps&experimental' }
    ]
  }
};

Settings

You can set default settings for Traceur in webpack.config.js, or in a require statement as a querystring.

List of Settings

runtime: Set to true to disable inclusion of the Traceur runtime library in your built file. Defaults to false.

All other options are passed directly to to the Traceur compiler. See this list for a list of all Traceur options, and see this guide for example usages of ES6 features supported by Traceur.

Demo

See the test/demo-app directory for demo of the loader.

License

MIT (License)

About

Webpack loader for Traceur, Google's ES6 to ES5 compiler

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 86.2%
  • Makefile 10.5%
  • HTML 3.3%