Socket
Socket
Sign inDemoInstall

babel-loader

Package Overview
Dependencies
130
Maintainers
5
Versions
77
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 8.2.1 to 8.2.2

4

lib/cache.js

@@ -28,3 +28,5 @@ "use strict";

const promisify = require("pify");
const {
promisify
} = require("util");

@@ -31,0 +33,0 @@ const transform = require("./transform"); // Lazily instantiated when needed

@@ -9,3 +9,5 @@ "use strict";

const promisify = require("pify");
const {
promisify
} = require("util");

@@ -12,0 +14,0 @@ const LoaderError = require("./Error");

{
"name": "babel-loader",
"version": "8.2.1",
"version": "8.2.2",
"description": "babel module loader for webpack",

@@ -13,6 +13,5 @@ "files": [

"dependencies": {
"find-cache-dir": "^2.1.0",
"find-cache-dir": "^3.3.1",
"loader-utils": "^1.4.0",
"make-dir": "^2.1.0",
"pify": "^4.0.1",
"make-dir": "^3.1.0",
"schema-utils": "^2.6.5"

@@ -19,0 +18,0 @@ },

> This README is for babel-loader v8 + Babel v7
> Check the [7.x branch](https://github.com/babel/babel-loader/tree/7.x) for docs with Babel v6
> If you are using legacy Babel v6, see the [7.x branch](https://github.com/babel/babel-loader/tree/7.x) docs

@@ -24,3 +24,3 @@ [![NPM Status](https://img.shields.io/npm/v/babel-loader.svg?style=flat)](https://www.npmjs.com/package/babel-loader)

> webpack 4.x | babel-loader 8.x | babel 7.x
> webpack `4.x || 5.x` | babel-loader 8.x | babel 7.x

@@ -42,7 +42,9 @@ ```bash

test: /\.m?js$/,
exclude: /(node_modules|bower_components)/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
presets: [
['@babel/preset-env', { targets: "defaults" }]
]
}

@@ -59,3 +61,3 @@ }

You can pass options to the loader by using the [`options`](https://webpack.js.org/configuration/module/#rule-options-rule-query) property:
You can pass options to the loader by using the [`options`](https://webpack.js.org/configuration/module/#ruleoptions--rulequery) property:

@@ -67,8 +69,10 @@ ```javascript

test: /\.m?js$/,
exclude: /(node_modules|bower_components)/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
plugins: ['@babel/plugin-proposal-object-rest-spread']
presets: [
['@babel/preset-env', { targets: "defaults" }]
],
plugins: ['@babel/plugin-proposal-class-properties']
}

@@ -101,2 +105,31 @@ }

### Some files in my node_modules are not transpiled for IE 11
Although we typically recommend not compiling `node_modules`, you may need to when using libraries that do not support IE 11.
For this, you can either use a combination of `test` and `not`, or [pass a function](https://webpack.js.org/configuration/module/#condition) to your `exclude` option. You can also use negative lookahead regex as suggested [here](https://github.com/webpack/webpack/issues/2031#issuecomment-294706065).
```javascript
{
test: /\.m?js$/,
exclude: {
test: /node_modules/, // Exclude libraries in node_modules ...
not: [
// Except for a few of them that needs to be transpiled because they use modern syntax
/unfetch/,
/d3-array|d3-scale/,
/@hapi[\\/]joi-date/,
]
},
use: {
loader: 'babel-loader',
options: {
presets: [
['@babel/preset-env', { targets: "ie 11" }]
]
}
}
}
```
### Babel is injecting helpers into each file and bloating my code!

@@ -120,7 +153,9 @@

test: /\.m?js$/,
exclude: /(node_modules|bower_components)/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
presets: [
['@babel/preset-env', { targets: "defaults" }]
],
plugins: ['@babel/plugin-transform-runtime']

@@ -211,5 +246,5 @@ }

"exclude": [
// \\ for Windows, \/ for Mac OS and Linux
/node_modules[\\\/]core-js/,
/node_modules[\\\/]webpack[\\\/]buildin/,
// \\ for Windows, / for macOS and Linux
/node_modules[\\/]core-js/,
/node_modules[\\/]webpack[\\/]buildin/,
],

@@ -216,0 +251,0 @@ "presets": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc