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

@nutui/babel-plugin-separate-import

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nutui/babel-plugin-separate-import

按需构建nutui2.0的组件,减小打包体积

  • 0.1.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
12
Maintainers
1
Weekly downloads
 
Created
Source

@nutui/babel-plugin-separate-import


按需引入Nutui2.0组件,减小打包体积;

安装


npm i -D @nutui/babel-plugin-separate-import

使用


配置.babelrc文件:

{
  "plugins": [
    ["@nutui/babel-plugin-separate-import", {
        "libraryName": "@nutui/nutui"
        "style": "css"
    }]
  ]
}

然后就可以像下面这样按需引入组件了:

import Vue from 'vue';
import { Button, Icon } from '@nutui/nutui';

Vue.component(Button.name, Button);
Vue.component(Icon.name, Icon);

AST转换


import { Button } from '@nutui/nutui';

当使用这种方式import组件时,将会被转换为:

import Button from '@nutui/nutui/dist/packages/button/button.vue';
import '@nutui/nutui/dist/packages/button/button.css';
  • 如果style选项为css,则会加载相应组件的css

  • 如果style选项为scss,则会加载相应组件的scss

  • 如果没有style选项,则不会加载样式文件,需用户手动添加;

Keywords

FAQs

Package last updated on 27 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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