Skip to content

conradz/jstransform-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jstransform-loader

Build Status

A webpack loader for jstransform.

This loader runs the source code through JSTransform, which can be used to transform ES6 code to ES5, or any other transforms to the JS source code.

Installation

npm install --save jstransform-loader

To use the JSTransform default visitors:

npm install --save jstransform-loader jstransform

Usage

Documentation: Using loaders

By default it will use the visitors built-in to JSTransform. You can specify a list of visitors that will be used by providing a comma-separated list in the loader query.

var foo = require('jstransform-loader!./foo');
// runs jstransform with the built-in jstransform visitors for es6 and imports
// it

var bar = require('jstransform-loader?./my-transform,other-transform!./bar');
// runs jstransform with the ./my-transform and ./other-transform visitors on
// the ./bar.js file and imports it

Example config

To run JSTransform on all your JS files, you can use the postLoader configuration option.

module.exports = {
    module: {
        postLoaders: [{ loader: 'jstransform-loader' }]
        // or specify list of visitors:
        // postLoaders: [{ loader: 'jstransform-loader?my-transforms' }]
    }
};

About

Webpack loader for JSTransform

Resources

Stars

Watchers

Forks

Packages

No packages published