Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mayank1791989/babel-loader

babel loader for webpack
https://github.com/mayank1791989/babel-loader

babel7 loader webpack webpack4

Last synced: about 15 hours ago
JSON representation

babel loader for webpack

Awesome Lists containing this project

README

        

[![npm](https://img.shields.io/npm/v/@playlyfe/babel-loader.svg?style=flat-square)](https://www.npmjs.com/package/@playlyfe/babel-loader)
[![npm](https://img.shields.io/npm/dt/@playlyfe/babel-loader.svg?style=flat-square)](https://www.npmjs.com/package/@playlyfe/babel-loader)
[![Travis](https://img.shields.io/travis/Mayank1791989/babel-loader.svg?style=flat-square)](https://travis-ci.org/Mayank1791989/babel-loader)



Babel logo


webpack logo

# babel-loader

> This package allows transpiling JavaScript files using [Babel](https://github.com/babel/babel) and [webpack](https://github.com/webpack/webpack).

## Requirements

```javascript
{
node: '>=8.0.0',
webpack: '>=4.0.0',
babel: '>=7.0.0'
}
```

## Install

```sh
$ npm install --save-dev @playlyfe/babel-loader
$ yarn add --dev @playlyfe/babel-loader
```

## Usage

webpack documentation: [Loaders](https://webpack.js.org/loaders/)

Within your webpack configuration object, you'll need to add the babel-loader to the list of modules, like so:

```javascript
module: {
rules: [
{
test: /\.m?js$/,
exclude: /node_modules/,
use: {
loader: '@playlyfe/babel-loader',
options: {
cacheDirectory: 'cache-dir-path'
}
}
}
]
}
```

## Options

* `cacheDirectory`: ```false | string``` (Default `false`). When set, the given directory will be used to cache the results of the loader. Future webpack builds will attempt to read from the cache to avoid needing to run the potentially expensive Babel recompilation process on each run.