Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-webpack-alias

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-webpack-alias - npm Package Compare versions

Comparing version 1.8.4 to 1.9.0

52

build/index.js

@@ -31,4 +31,4 @@ 'use strict';

// exit if there's no alias config
if (!conf.resolve || !conf.resolve.alias) {
// exit if there's no alias config and the config is not an array
if (!(conf.resolve && conf.resolve.alias) && !Array.isArray(conf)) {
return;

@@ -38,5 +38,49 @@ }

// Get the webpack alias config
const aliasConf = conf.resolve.alias;
const extensionsConf = conf.resolve.extensions && conf.resolve.extensions.length ? conf.resolve.extensions : null;
let aliasConf;
let extensionsConf;
if (Array.isArray(conf)) {
// the exported webpack config is an array ...
// (i.e., the project is using webpack's multicompile feature) ...
// reduce the configs to a single alias object
aliasConf = conf.reduce((prev, curr) => {
const next = Object.assign({}, prev);
if (curr.resolve && curr.resolve.alias) {
Object.assign(next, curr.resolve.alias);
}
return next;
}, {});
// if the object is empty, bail
if (!Object.keys(aliasConf).length) {
return;
}
// reduce the configs to a single extensions array
extensionsConf = conf.reduce((prev, curr) => {
const next = [].concat(prev);
if (curr.resolve && curr.resolve.extensions && curr.resolve.extensions.length) {
curr.resolve.extensions.forEach(ext => {
if (next.indexOf(ext) === -1) {
next.push(ext);
}
});
}
return next;
}, []);
if (!extensionsConf.length) {
extensionsConf = null;
}
} else {
// the exported webpack config is a single object...
// use it's resolve.alias property
aliasConf = conf.resolve.alias;
// use it's resolve.extensions property, if available
extensionsConf = conf.resolve.extensions && conf.resolve.extensions.length ? conf.resolve.extensions : null;
}
var _path$node = path.node;

@@ -43,0 +87,0 @@ const calleeName = _path$node.callee.name;

2

package.json
{
"version": "1.8.4",
"version": "1.9.0",
"name": "babel-plugin-webpack-alias",

@@ -4,0 +4,0 @@ "description": "babel 6 plugin which allows to use webpack aliases",

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