0.2.0 • Published 11 years ago
jstransform-loader v0.2.0
jstransform-loader
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-loaderTo use the JSTransform default visitors:
npm install --save jstransform-loader jstransformUsage
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 itExample 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' }]
}
};