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.2 to 8.2.3

10

lib/cache.js

@@ -94,3 +94,11 @@ "use strict";

const filename = function (source, identifier, options) {
const hash = crypto.createHash("md4");
// md4 hashing is not supported starting with node v17.0.0
const majorNodeVersion = parseInt(process.versions.node.split(".")[0], 10);
let hashType = "md4";
if (majorNodeVersion >= 17) {
hashType = "md5";
}
const hash = crypto.createHash(hashType);
const contents = JSON.stringify({

@@ -97,0 +105,0 @@ source,

18

lib/index.js

@@ -201,8 +201,18 @@ "use strict";

result = yield transform(source, options);
} // TODO: Babel should really provide the full list of config files that
// were used so that this can also handle files loaded with 'extends'.
} // Availabe since Babel 7.12
// https://github.com/babel/babel/pull/11907
if (typeof config.babelrc === "string") {
this.addDependency(config.babelrc);
if (config.files) {
config.files.forEach(configFile => this.addDependency(configFile));
} else {
// .babelrc.json
if (typeof config.babelrc === "string") {
this.addDependency(config.babelrc);
} // babel.config.js
if (config.config) {
this.addDependency(config.config);
}
}

@@ -209,0 +219,0 @@

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

@@ -47,3 +47,3 @@ "files": [

"semver": "7.3.2",
"webpack": "^5.4.0"
"webpack": "^5.34.0"
},

@@ -50,0 +50,0 @@ "scripts": {

@@ -91,2 +91,4 @@ > This README is for babel-loader v8 + Babel v7

* `metadataSubscribers`: Default `[]`. Takes an array of context function names. E.g. if you passed ['myMetadataPlugin'], you'd assign a subscriber function to `context.myMetadataPlugin` within your webpack plugin's hooks & that function will be called with `metadata`.
## Troubleshooting

@@ -112,3 +114,3 @@

exclude: {
test: /node_modules/, // Exclude libraries in node_modules ...
and: [/node_modules/], // Exclude libraries in node_modules ...
not: [

@@ -253,2 +255,22 @@ // Except for a few of them that needs to be transpiled because they use modern syntax

### Top level function (IIFE) is still arrow (on Webpack 5)
That function is injected by Webpack itself _after_ running `babel-loader`. By default Webpack asumes that your target environment supports some ES2015 features, but you can overwrite this behavior using the `output.environment` Webpack option ([documentation]((https://webpack.js.org/configuration/output/#outputenvironment)).
To avoid the top-level arrow function, you can use `output.environment.arrowFunction`:
```js
// webpack.config.js
module.exports = {
// ...
output: {
// ...
environment: {
// ...
arrowFunction: false, // <-- this line does the trick
},
},
};
```
## Customize config based on webpack target

@@ -255,0 +277,0 @@

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