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

vite-unplugin-components-tools

v0.0.6

Published

arco-design UI components vue version awesome tools

Downloads

26

Readme

vite-unplugin-components-tools

viteUnpluginCssUnBundlePlugin

主要用于业务组件库使用,防止在业务组件库中在使用 vite unplugin 会将重复基础样式 css 文件引入到业务项目中,

  • 例子: business-component 使用了 arco-design/web-vue unplugin, 则会将 arco css 打包到 css 文件中,而在业务项目中同时使用 arco-design/web-vue unplugin 和引入 business-component/dist/index.css,则会重复导入 arco css 文件,导致样式文件过大。 用法
export default defineConfig({
  plugins: [
    vue(),
    Components({
      extensions: ['vue'],
      resolvers: [
        ArcoResolver({
          resolveIcons: {
            enable: true,
          },
          sideEffect: true,
        }),
      ],
      dts: './config/unplugin/components.d.ts',
    }),
    AutoImport({
      imports: ['vue'],
      resolvers: [
        ArcoResolver({
          resolveIcons: {
            enable: true,
          },
        }),
      ],
      dts: './config/unplugin/auto-imports.d.ts',
    }),
    viteUnpluginUnBundlePlugin({
      // importStyle 对应的是 arco unplugin 将引入哪些 style 文件,'css' 或者 'less','all' 则表示全部引入,该插件则会根据该选项进行移除
      // generateBundleImportStyle 则表示在生成阶段将移除的 style 添加回来
      '@arco-design/web-vue': { importStyle: 'all', generateBundleImportStyle: 'css' },
    }),
  ],
});

viteUnpluginUnBundlePlugin

对比 viteUnpluginCssUnBundlePlugin 增加了 icon 的处理,原理是使用 resolveId 将文件设置为 external 不需要 babel 去解析源码,推荐使用 viteUnpluginCssUnBundlePlugin

export default defineConfig({
  plugins: [
    vue(),
    Components({
      extensions: ['vue'],
      resolvers: [
        ArcoResolver({
          resolveIcons: {
            enable: true,
          },
          sideEffect: true,
        }),
      ],
      dts: './config/unplugin/components.d.ts',
    }),
    AutoImport({
      imports: ['vue'],
      resolvers: [
        ArcoResolver({
          resolveIcons: {
            enable: true,
          },
        }),
      ],
      dts: './config/unplugin/auto-imports.d.ts',
    }),
    viteUnpluginUnBundlePlugin({
      // resolveIcons 对应 arco unplugin 是否引入 icon
      '@arco-design/web-vue': { importStyle: 'all', resolveIcons: true },
    }),
  ],
});

peerDepsNoBiddingImportRemove

移除 peerDeps 的全量引入,例如 import "vue";