npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@arco-plugins/unplugin-react

v1.0.2

Published

arco plugin

Downloads

14

Readme

@arco-plugins/unplugin-react

@arco-plugins/unplugin-react is a build plugin that helps with arco problems.

It implements cross-bundler build capabilities based on unplugin.

Features

The features of the plugin are as follows:

  1. On-demand loading of styles: Automatically configure import conversion plugins to implement on-demand loading of styles.
  2. Removal of font packages included in component libraries: Specify removeFontFace as true to remove the font files included in the component library.
  3. Icon replacement: Specify the package name of the icon library, and the plugin will read the icons in the package and replace them with the same-named icons used in the component library.
  4. Default language replacement: The default imported language package of the component library is Chinese, which means that the packaging will definitely include Chinese. If you don't want Chinese, you can use this parameter to replace it with the language you need.

Support

| Configuration item | Webpack | Rspack | Vite | |:---------------------:|:-------:|:------:|:----:| | style | ⚪ | 🟢 | ⚪ | | libraryDirectory | ⚪ | 🟢 | ⚪ | | iconBox | ⚪ | 🟢 | ⚪ | | removeFontFace | ⚪ | 🟢 | ⚪ | | defaultLanguage | ⚪ | 🟢 | ⚪ | | theme | ⚪ | 🟢 | ⚪ | | context | ⚪ | ⚪ | ⚪ | | include | ⚪ | ⚪ | ⚪ | | extensions | ⚪ | ⚪ | ⚪ | | babelConfig | ⚪ | ⚪ | ⚪ | | modifyVars | ⚪ | ⚪ | ⚪ | | webpackImplementation | ⚪ | ⚪ | ⚪ | | varsInjectScope | ⚪ | ⚪ | ⚪ | | modifyBabelLoader | ⚪ | ⚪ | ⚪ |

Rspack

Compared to @arco-plugins/webpack-react, there are some differences when using it in conjunction with Rspack. This is due to the underlying differences between Rspack and webpack.

export interface ArcoDesignPluginOptions {
  style?: string | boolean;
  libraryDirectory?: string;
  iconBox?: string;
  removeFontFace?: boolean;
  defaultLanguage?: string;
  theme?: string;
- context?: string;
- include: (string | RegExp)[];
- extensions: string[];
- babelConfig?: object;
- modifyVars?: Record<string, string>;
- webpackImplementation?: typeof webpack;
- varsInjectScope?: (string | RegExp)[];
- modifyBabelLoader?: boolean | 'merge' | 'override';
}

Unlike webpack, Rspack no longer uses Babel for limited-range code conversion, but instead uses SWC to process all code, including third-party dependencies. Therefore, support for include, extensions, babelConfig, and modifyBabelLoader configurations has been removed.

In addition, because support for webpack@4 has been abandoned and internal implementation has been improved, context and webpackImplementation configuration is no longer required.

For maintainability reasons, @arco-plugins/unplugin-react no longer supports the modifyVars and varsInjectScope configuration items. You can achieve the same function by manually configuring the less-loader.

Install

Install this tool via package manager:

# npm
$ npm install -D @arco-plugins/unplugin-react

# yarn
$ yarn add -D @arco-plugins/unplugin-react

# pnpm
$ pnpm add -D @arco-plugins/unplugin-react

Usage

Take Rspack for example, the usage is to add the following content to the rspack.config.js file:

const { ArcoDesignPlugin } = require('@arco-plugins/unplugin-react');

module.exports = {
  module: {
    rules: [
      {
        type: 'css',
        test: /\.less$/,
        use: [{ loader: 'less-loader' }],
      },
    ],
  },
  plugins: [
    new ArcoDesignPlugin({
      theme: '@arco-themes/react-asuka',
      iconBox: '@arco-iconbox/react-partial-bits',
      removeFontFace: true,
    }),
  ],
};

You can also find an actual available example project in example-rspack-react.

options

The plugin supports the following parameters:

|Parameter |Type|Default|Description| |:--:|:--:|:-----:|:----------| |theme|{string}|-|Theme package name| |iconBox|{string}|-|Icon library package name| |libraryDirectory|{'es'\|'lib'}|'es'|Export format| |style|{string\|boolean}|true|Style import method| |removeFontFace|{boolean}|false|Removes the font file included in the component library| |defaultLanguage|{string}|-|Replace default language, language list|