Socket
Book a DemoInstallSign in
Socket

@lexiang/babel-plugin-component

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lexiang/babel-plugin-component

Modular build plugin for babel.

0.2.7
latest
npmnpm
Version published
Maintainers
2
Created
Source

Introduction

lazy load component, base on babel-plugin-component

Install

yarn add @lexiang/babel-plugin-component -D

Usage

Via .babelrc or babel-loader.

{
  "plugins": [
    ["@lexiang/babel-plugin-component", options]
  ]
}

options

  • libraryName: module name
  • styleLibraryName: style module name
  • styleLibrary: Import a independent theme package with more config
    styleLibrary: {
      "name": "xxx", // same with styleLibraryName
      "base": true,  // if theme package has a base.css
      "path": "[module]/index.css",  // the style path. e.g. module Alert =>  alert/index.css
      "mixin": true  // if theme-package not found css file, then use [libraryName]'s css file
    }
    
  • style: import css from '[module]/index.css', default false
  • libDir: dist directory, default lib
  • root: main file dir, default index
  • camel2Dash: whether parse name to dash mode or not, default true

Example

convert

import { button } from 'components';

to

var button = require('components/lib/button');

style Example

when it is set to true convert

import { button } from 'components';

to

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

Keywords

babel-plugin

FAQs

Package last updated on 30 Nov 2020

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.