Socket
Socket
Sign inDemoInstall

babel-plugin-alias-modules

Package Overview
Dependencies
Maintainers
13
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 2.19.4 to 2.20.0

6

package.json
{
"author": "Liferay Frontend Infrastructure Team <pt-frontend-infrastructure@liferay.com>",
"dependencies": {
"liferay-npm-build-tools-common": "2.19.4"
"liferay-npm-build-tools-common": "2.20.0"
},

@@ -19,4 +19,4 @@ "description": "A Babel plugin to rewrite aliased require() calls.",

},
"version": "2.19.4",
"gitHead": "d341f385c91a7d50168a6ce8be978d2f03f6bedc"
"version": "2.20.0",
"gitHead": "c346146c8c8e6f7c12356f68dc7153efc6445e89"
}

@@ -7,5 +7,3 @@ # babel-plugin-alias-modules

The plugin can be configured using
[.npmbundlerrc global config section](https://github.com/liferay/liferay-js-toolkit/wiki/.npmbundlerrc-file-reference#config)
or in the plugin configuration itself.
The plugin can be configured using [.npmbundlerrc global config section](https://github.com/liferay/liferay-frontend-projects/tree/master/maintenance/projects/js-toolkit/docs/.npmbundlerrc-file-reference.md#config) or in the plugin configuration itself.

@@ -22,33 +20,22 @@ In both cases the structure is the same:

This resembles webpack's
[resolve.aliasFields](https://webpack.js.org/configuration/resolve/#resolvealiasfields)
which serves the same purpose.
This resembles webpack's [resolve.aliasFields](https://webpack.js.org/configuration/resolve/#resolvealiasfields) which serves the same purpose.
Normally global config is preferred, but you can leverage plugin configuration
when you need different alias fields for different packages.
Normally global config is preferred, but you can leverage plugin configuration when you need different alias fields for different packages.
The default value for `resolve.aliasFields` is `['browser']` as in webpack.
Note that this plugin used to look for `unpkg` and `jsdelivr` fields too, but it
caused problems (see https://github.com/liferay/liferay-js-toolkit/issues/365
for more information).
Note that this plugin used to look for `unpkg` and `jsdelivr` fields too, but it caused problems (see https://github.com/liferay/liferay-js-toolkit/issues/365 for more information).
## Technical Details
This plugin scans `package.json` for fields defined in `resolve.aliasFields`
and redirects `require()`s for aliased modules.
This plugin scans `package.json` for fields defined in `resolve.aliasFields` and redirects `require()`s for aliased modules.
This plugin only does one part of the whole implementation of the aliases.
Aliases implementation have two parts:
This plugin only does one part of the whole implementation of the aliases. Aliases implementation have two parts:
1. They redirect existing modules or provide virtual ones when seen from
the outside, from another package.
1. They redirect existing modules or provide virtual ones when seen from the outside, from another package.
2. They make local requires divert to a different target.
This plugin does only the second part. The first one is performed by
[liferay-npm-bundler-plugin-replace-browser-modules](https://github.com/liferay/liferay-js-toolkit/tree/master/packages/liferay-npm-bundler-plugin-replace-browser-modules).
This plugin does only the second part. The first one is performed by [liferay-npm-bundler-plugin-replace-browser-modules](https://github.com/liferay/liferay-frontend-projects/tree/master/maintenance/projects/js-toolkit/packages/liferay-npm-bundler-plugin-replace-browser-modules).
Please read the
[`browser` field specification](https://github.com/defunctzombie/package-browser-field-spec)
for more information.
Please read the [`browser` field specification](https://github.com/defunctzombie/package-browser-field-spec) for more information.

@@ -96,3 +96,4 @@ /**

).linkToCode(5);
} else if (aliasedModuleName !== argument.value) {
}
else if (aliasedModuleName !== argument.value) {
argument.value = aliasedModuleName;

@@ -134,2 +135,3 @@

if (mod.isLocalModule(requiredModuleName)) {
// First look in file directory (without recursion)

@@ -168,3 +170,4 @@

}
} else {
}
else {
alias = this._getAliasForExternal(absFileDir, requiredModule);

@@ -171,0 +174,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