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

@39nyx/dumi-plugin-preset-vue2

v1.0.4

Published

Vue support plugins for dumi

Readme

@39nyx/dumi-plugin-preset-vue2

此项目是根据官方的dumi-theme-vue插件进行修改,做了vue2版本的适配。

安装

pnpm add @39nyx/dumi-plugin-preset-vue2

配置

dumi.config.ts 中引入插件:

import { defineConfig } from 'dumi';

export default defineConfig({
  presets: ['@39nyx/dumi-plugin-preset-vue2'],
});

集成第三方组件库

集成element-ui组件库为例, 需要注意如果集成element-ui组件库vue的版本不能超过2.7.0,否则el-table组件不会渲染。

在根目录创建runtime文件夹,在文件夹下创建renderer.js文件, 内容如下

import Vue from 'vue';

// 集成ElementUI, 其他组件类似
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'

Vue.use(ElementUI)

// 创建实例前配置全局错误处理
Vue.config.errorHandler = function (err, vm, info) {
  // 在此处理错误(如发送日志、抛给上层)
  console.error('Vue 错误:', err, info);

  // 如果需要抛给外部(如 React 错误边界)
  throw err; // 抛出错误让上层捕获
};

const renderer = async function (canvas, component) {
  if (component.__css__) {
    setTimeout(() => {
      document
        .querySelectorAll(`style[css-${component.__id__}]`)
        .forEach((el) => el.remove());
      document.head.insertAdjacentHTML(
        'beforeend',
        `<style css-${component.__id__}>${component.__css__}</style>`,
      );
    }, 1);
  }
  const app = new Vue(component)
  app.$mount(canvas);
  return () => {
    app.$destroy();
  };
};

export default renderer;

这里需要导出一个渲染函数, 是一定要实现的, 上面的renderer函数是一个通用实现,可以也可根据实际情况进行修改。

然后在dumi.config.ts中配置runtime路径

import { defineConfig } from 'dumi';

export default defineConfig({
  presets: ['@39nyx/dumi-plugin-preset-vue2'],
  vue: {
    compiler: {
      // 配置创建好的渲染函数路径, 如果不配置,会使用默认提供的渲染函数
      rendererPath: 'runtime/renderer.js'
    }
  },
});

babelStandaloneCDN 配置

@babel/standalone默认加载地址是https://cdn.bootcdn.net/ajax/libs/babel-standalone/7.22.17/babel.min.js, 如果需要自定义加载地址,可以在dumi.config.ts中配置babelStandaloneCDN参数。

import { defineConfig } from 'dumi';

export default defineConfig({
  presets: ['@39nyx/dumi-plugin-preset-vue2'],
  vue: {
    compiler: {
      // 如果不配置,会使用默认地址: https://cdn.bootcdn.net/ajax/libs/babel-standalone/7.22.17/babel.min.j
      babelStandaloneCDN: '更改为自定义加载地址'
    }
  },
});