babel-plugin-import
Advanced tools
Comparing version
@@ -58,10 +58,11 @@ 'use strict'; | ||
camel2DashComponentName = _ref3.camel2DashComponentName, | ||
camel2UnderlineComponentName = _ref3.camel2UnderlineComponentName; | ||
camel2UnderlineComponentName = _ref3.camel2UnderlineComponentName, | ||
fileName = _ref3.fileName; | ||
(0, _assert2.default)(libraryName, 'libraryName should be provided'); | ||
return new _Plugin2.default(libraryName, libraryDirectory, style, camel2DashComponentName, camel2UnderlineComponentName, types); | ||
return new _Plugin2.default(libraryName, libraryDirectory, style, camel2DashComponentName, camel2UnderlineComponentName, fileName, types); | ||
}); | ||
} else { | ||
(0, _assert2.default)(opts.libraryName, 'libraryName should be provided'); | ||
plugins = [new _Plugin2.default(opts.libraryName, opts.libraryDirectory, opts.style, opts.camel2DashComponentName, opts.camel2UnderlineComponentName, types)]; | ||
plugins = [new _Plugin2.default(opts.libraryName, opts.libraryDirectory, opts.style, opts.camel2DashComponentName, opts.camel2UnderlineComponentName, opts.fileName, types)]; | ||
} | ||
@@ -68,0 +69,0 @@ } |
@@ -32,3 +32,3 @@ 'use strict'; | ||
var Plugin = function () { | ||
function Plugin(libraryName, libraryDirectory, style, camel2DashComponentName, camel2UnderlineComponentName, types) { | ||
function Plugin(libraryName, libraryDirectory, style, camel2DashComponentName, camel2UnderlineComponentName, fileName, types) { | ||
_classCallCheck(this, Plugin); | ||
@@ -44,2 +44,3 @@ | ||
this.style = style || false; | ||
this.fileName = fileName || ''; | ||
this.types = types; | ||
@@ -56,3 +57,3 @@ } | ||
? camel2Underline(methodName) : this.camel2DashComponentName ? camel2Dash(methodName) : methodName; | ||
var path = winPath((0, _path.join)(this.libraryName, libraryDirectory, transformedMethodName)); | ||
var path = winPath((0, _path.join)(this.libraryName, libraryDirectory, transformedMethodName, this.fileName)); | ||
this.selectedMethods[methodName] = file.addImport(path, 'default'); | ||
@@ -59,0 +60,0 @@ if (style === true) { |
{ | ||
"name": "babel-plugin-import", | ||
"version": "1.2.1", | ||
"version": "1.3.0", | ||
"description": "Component modular import plugin for babel.", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -82,4 +82,3 @@ # babel-plugin-import | ||
{ | ||
"libraryName": "antd-mobile", | ||
"libraryDirectory": "component", | ||
"libraryName": "antd-mobile" | ||
}, | ||
@@ -97,2 +96,2 @@ ] | ||
babel-plugin-import will be not working if you add the library in webpack config [vendor](https://webpack.github.io/docs/code-splitting.html#split-app-and-vendor-code). | ||
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). |
15633
0.62%308
0.65%96
-1.03%