1.0.2 • Published 2 years ago

babel-transform-import-plugin v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

babel-transform-import-plugin

babel插件用于修改引用包名

Install

yarn add -D babel-transform-import-plugin

or

npm i babel-transform-import-plugin --save-dev

案例

{
  "plugins": [
  ["babel-transform-import-plugin", {
    // 要替换的包名
    "libraryName": "@uiw/react-native",
    // 转换的包名
    "alias": "@uiw/react-native/lib"
  }]
]
}

import {Button, Spacing} from '@uiw/react-native';

转换成

import Button from "@uiw/react-native/lib/Button";
import Spacing from "@uiw/react-native/lib/Spacing";