0.0.6 • Published 6 years ago

babel-plugin-trans-import v0.0.6

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

babel-plugin-trans-import

a babel plugin that can transform library import from import declaration to default import declaration

Installation

npm i babel-plugin-trans-import -D

Usage

plugins: [
  ["trans-import", { "lib": "library name", "dir": "library directory name" }]
]

Paramters

lib: library name

  • type: <string>

dir: library directory name

  • type: <string>
  • default: 'lib'

Example

// plugins: [
//   ["trans-import", { "lib": "zcos", "dir": "zcos/lib" }]
// ]

// before transform
import { list, env } from 'zcos';

// after transform
import list from 'zcos/lib/list';
import env from 'zcos/lib/env';

Development Plan

  • support to transform import declaration like import { methods } from 'lib'
  • support to transform import declaration like import method, { method } from 'lib'