babel-loader
Advanced tools
Comparing version 8.2.1 to 8.2.2
@@ -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": [ |
40355
6
499
379
+ Added@types/node@20.12.11(transitive)
+ Addedcaniuse-lite@1.0.30001616(transitive)
+ Addedelectron-to-chromium@1.4.763(transitive)
+ Addedfind-cache-dir@3.3.2(transitive)
+ Addedfind-up@4.1.0(transitive)
+ Addedlocate-path@5.0.0(transitive)
+ Addedmake-dir@3.1.0(transitive)
+ Addedp-locate@4.1.0(transitive)
+ Addedpath-exists@4.0.0(transitive)
+ Addedpicocolors@1.0.0(transitive)
+ Addedpkg-dir@4.2.0(transitive)
+ Addedupdate-browserslist-db@1.0.15(transitive)
- Removedpify@^4.0.1
- Removed@types/node@20.12.12(transitive)
- Removedcaniuse-lite@1.0.30001618(transitive)
- Removedelectron-to-chromium@1.4.769(transitive)
- Removedfind-cache-dir@2.1.0(transitive)
- Removedfind-up@3.0.0(transitive)
- Removedlocate-path@3.0.0(transitive)
- Removedmake-dir@2.1.0(transitive)
- Removedp-locate@3.0.0(transitive)
- Removedpath-exists@3.0.0(transitive)
- Removedpicocolors@1.0.1(transitive)
- Removedpify@4.0.1(transitive)
- Removedpkg-dir@3.0.0(transitive)
- Removedsemver@5.7.2(transitive)
- Removedupdate-browserslist-db@1.0.16(transitive)
Updatedfind-cache-dir@^3.3.1
Updatedmake-dir@^3.1.0