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

babel-plugin-import

Package Overview
Dependencies
Maintainers
4
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-import - npm Package Compare versions

Comparing version 1.9.1 to 1.10.0

7

lib/index.js

@@ -68,9 +68,10 @@ "use strict";

fileName = _ref3.fileName,
customName = _ref3.customName;
customName = _ref3.customName,
transformToDefaultImport = _ref3.transformToDefaultImport;
(0, _assert.default)(libraryName, 'libraryName should be provided');
return new _Plugin.default(libraryName, libraryDirectory, style, camel2DashComponentName, camel2UnderlineComponentName, fileName, customName, types);
return new _Plugin.default(libraryName, libraryDirectory, style, camel2DashComponentName, camel2UnderlineComponentName, fileName, customName, transformToDefaultImport, types);
});
} else {
(0, _assert.default)(opts.libraryName, 'libraryName should be provided');
plugins = [new _Plugin.default(opts.libraryName, opts.libraryDirectory, opts.style, opts.camel2DashComponentName, opts.camel2UnderlineComponentName, opts.fileName, opts.customName, types)];
plugins = [new _Plugin.default(opts.libraryName, opts.libraryDirectory, opts.style, opts.camel2DashComponentName, opts.camel2UnderlineComponentName, opts.fileName, opts.customName, opts.transformToDefaultImport, types)];
}

@@ -77,0 +78,0 @@ }

@@ -41,3 +41,3 @@ "use strict";

function () {
function Plugin(libraryName, libraryDirectory, style, camel2DashComponentName, camel2UnderlineComponentName, fileName, customName, types) {
function Plugin(libraryName, libraryDirectory, style, camel2DashComponentName, camel2UnderlineComponentName, fileName, customName, transformToDefaultImport, types) {
(0, _classCallCheck2.default)(this, Plugin);

@@ -54,2 +54,3 @@ this.specified = null;

this.customName = customName;
this.transformToDefaultImport = typeof transformToDefaultImport === 'undefined' ? true : transformToDefaultImport;
this.types = types;

@@ -78,5 +79,5 @@ }

);
this.selectedMethods[methodName] = (0, _helperModuleImports.addDefault)(file.path, path, {
this.selectedMethods[methodName] = this.transformToDefaultImport ? (0, _helperModuleImports.addDefault)(file.path, path, {
nameHint: methodName
});
}) : (0, _helperModuleImports.addNamed)(file.path, methodName, path);

@@ -83,0 +84,0 @@ if (style === true) {

{
"name": "babel-plugin-import",
"version": "1.9.1",
"version": "1.10.0",
"description": "Component modular import plugin for babel.",

@@ -5,0 +5,0 @@ "repository": {

@@ -133,3 +133,3 @@ # babel-plugin-import

### style
#### style

@@ -163,3 +163,3 @@ - `["import", { "libraryName": "antd" }]`: import js modularly

### customName
#### customName

@@ -209,4 +209,8 @@ We can use `customName` to customize import file path.

#### transformToDefaultImport
Set this option to `false` if your module does not have a `default` export.
### Note
babel-plugin-import will not work properly if you add the library to the webpack config [vendor](https://webpack.github.io/docs/code-splitting.html#split-app-and-vendor-code).
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