light-babel-import

1.6.8 • Public • Published

babel-plugin-import

一个轻量的按需加载库

NPM version


Install

npm install light-babel-import --save-dev

Example

Converts

import { _isUrl } from 'light-utils'

to

var _isUrl = require('light-utils/lib/_isUrl')

styleLibraryName Example

Converts

import Components from 'components'
import { Button } from 'components'

to

require('components/lib/styleLibraryName/index.css')
var button = require('components/lib/styleLibraryName/button.css')

Usage

Via .babelrc or babel-loader.

{
  "plugins": [["light-babel-import", options]]
}

Multiple Module

{
  "plugins": [xxx,
    ["light-babel-import", {
      libraryName: "antd",
      style: true,
    }, "antd"],
    ["light-babel-import", {
      libraryName: "test-module",
      style: true,
    }, "test-module"]
  ]
}

Readme

Keywords

Package Sidebar

Install

npm i light-babel-import

Weekly Downloads

0

Version

1.6.8

License

MIT

Unpacked Size

16.4 kB

Total Files

4

Last publish

Collaborators

  • rhymedys