1. jstransform-loader
Webpack loader for JSTransform
jstransform-loader
Package: jstransform-loader
Created by: conradz
Last modified: Sun, 19 Jun 2022 07:00:10 GMT
Version: 0.2.0
License: BSD
Downloads: 930
Repository: https://github.com/conradz/jstransform-loader

Install

npm install jstransform-loader
yarn add jstransform-loader

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' }]
    }
};

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code