Socket
Socket
Sign inDemoInstall

babel-loader

Package Overview
Dependencies
Maintainers
2
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-loader - npm Package Compare versions

Comparing version 5.1.0 to 5.1.2

2

lib/fs-cache.js

@@ -40,3 +40,3 @@ /**

return callback(null, content);
return callback(null, result);
});

@@ -43,0 +43,0 @@ });

{
"name": "babel-loader",
"version": "5.1.0",
"version": "5.1.2",
"description": "babel module loader for webpack",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -112,4 +112,61 @@ # babel-loader

#### custom polyfills (e.g. Promise library)
### using `cacheDirectory` fails with Error
If using cacheDirectory results in an error similar to the following:
```
ERROR in ./frontend/src/main.jsx
Module build failed: Error: ENOENT, open 'true/350c59cae6b7bce3bb58c8240147581bfdc9cccc.json.gzip'
@ multi app
```
(notice the `true/` in the filepath)
That means that most likely, you're not setting the options correctly, and you're doing something similar to:
```javascript
loaders: [
// the optional 'runtime' transformer tells babel to require the runtime
// instead of inlining it.
{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader?cacheDirectory=true'
}
]
```
That's not the correct way of setting boolean values. You should do instead:
```javascript
loaders: [
// the optional 'runtime' transformer tells babel to require the runtime
// instead of inlining it.
{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader?cacheDirectory'
}
]
```
or use the [query](https://webpack.github.io/docs/using-loaders.html#query-parameters) property:
```javascript
loaders: [
// the optional 'runtime' transformer tells babel to require the runtime
// instead of inlining it.
{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
query: {
cacheDirectory: true
}
}
]
```
### custom polyfills (e.g. Promise library)
Since Babel includes a polyfill that includes a custom [regenerator runtime](https://github.com/facebook/regenerator/blob/master/runtime.js) and [core.js](https://github.com/zloirock/core-js), the following usual shimming method using `webpack.ProvidePlugin` will not work:

@@ -116,0 +173,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc