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 🙏

© 2026 – Pkg Stats / Ryan Hefner

maque-packages

v1.0.10

Published

## 1、自定义组件的开发

Readme

自定义NPM组件

1、自定义组件的开发

Vue组件开发

请参考 mq-component 文件夹

mq-index.vue: 组件的具体内容

index.ts: 用于定义组件的名称以及安装

package.json配置

{
  "name": "maque-packages", //安装到npmjs上的名称,用于被人安装
  "private": false,
  "version": "1.0.4", //版本
  "type": "module",
   //规定哪些文件上传到npmjs.org服务器上
  "files": [
    "dist", //打包出来的目录,这样源码不就会上传
    "index.d.ts",
    "package.json"
  ],
  "main": "./dist/index.umd.cjs", //加载入口
  "module": "./dist/index.js", //加载入口
  "types": "./index.d.ts", //定义文件
  "exports": {
    ".": {
      "types": "./index.d.ts",
      "import": "./dist/index.js",
      "require": "./dist/index.umd.cjs"
    },
    "./*": "./*"
  },
  "style": "dist/style.css", //样式文件
}

依赖包配置

作为一纯粹的组件包,如果你依赖了许多组件,但是有些组件不想被打包进来,不然包就会大,比如Element-Plus,这个就需要排除掉

配置 vite.config.ts

import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue({
      script: {
        defineModel: true
      }
    })],
  build: {
    lib: {
      entry: './src/index.ts', //指定组件的总入口
      name: 'MaquePackages',//指定组件的name
      fileName: 'index'
    },
     
   //排除打包掉的内容,
    rollupOptions: {
      external: ['vue', "element-plus", "xlsx", "xlsx-style-vite", "file-saver", "@types/lodash"],
      output: {
        globals: {
          vue: 'Vue',
          "element-plus": "element-plus",
          "xlsx": "xlsx",
          "xlsx-style-vite": "xlsx-style-vite"
        }
      }
    }
  }
})

2、组件发布

对组件进行打包

pnpm run build

到 https://npmjs.org/ 注册账号

确保本地的npm源为 官方源 https://registry.npmjs.org/

如果不清楚,执行命令可查看:

npm get registry

先登陆 npmjs

npm login

登陆成功后

再执行发布

npm publish

发布成功,登陆 https://npmjs.org/ 可以在你的packages下面,看到你发布的内容

如果以后要修改发布,必须修改package.json里的版本号才能再发布。

组件修改了内容,必须重新npm run build。

下一次发布时,就不用再login了,直接publish即可