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

createroute-webpack-plugin

v1.0.5

Published

根据目录结构自动生成vue路由

Readme

create-route

使用

image

plugins: [
  new CreateRoute({
    pagesDir: 'src/view', // vue页面位置
    output: 'src/routes.js', // 输出路由文件位置
    mixin: { // 定义混入属性
      'l': {
        meta: {
          auth: true
        }
      }
    }
  })
]

生成routes.js文件

export default [
	{
		path: "/test",
		component: () => import("./view/test.vue"),
		name: "test"
	},
	{
		path: "/double-11",
		component: () => import("./view/double-11/index.vue"),
		name: "double-11_index"
	},
	{
		path: "/404",
		component: () => import("./view/404.vue"),
		name: "404"
	},
	{
		path: "/double-11/draw",
		component: () => import("./view/double-11/draw l.vue"),
		meta: {"auth":true},
		name: "double-11_draw"
	},
	{
		path: "/double-11/result",
		component: () => import("./view/double-11/result.vue"),
		name: "double-11_result"
	}
]

删除路由

在文件夹或者vue文件名前加"!"符号

首页路由

在文件夹里有'index.vue'文件时,被认为是该路由首页,路由中不显示'index'

动态路由

当文件以'_'开头时,被认为是动态路由,文件名为params

嵌套路由

当文件中vue文件与子文件夹名字相同时,被认为是嵌套路由,该vue组件里需有""作为父组件

image

export default [
	{
		path: "/test",
		component: () => import("./view/test.vue"),
		children: [
			{
				path: "",
				component: () => import("./view/test/index.vue"),
				name: "test_index"
			},
			{
				path: "a",
				component: () => import("./view/test/a.vue"),
				children: [
					{
						path: "",
						component: () => import("./view/test/a/index.vue"),
						name: "test_a_index"
					},
					{
						path: "b",
						component: () => import("./view/test/a/b.vue"),
						name: "test_a_b"
					}
				]
			},
			{
				path: ":id?",
				component: () => import("./view/test/_id.vue"),
				name: "test_id"
			}
		]
	},
	{
		path: "/404",
		component: () => import("./view/404.vue"),
		name: "404"
	}
]

混入属性

在mixin中定义的混入属性,在生成路由时,会判断文件名里是否有改属性的key,(用空格分开)如果有,则将改属性混入路由属性中

mixin: {
  'l': {
    meta: {
      auth: true
    }
  }
}

文件路径: 'src/view//double-11/draw l.vue',生成文件:

{
	path: "/double-11/draw",
	component: () => import("./view/double-11/draw l.vue"),
	meta: {"auth":true},
	name: "double-11_draw"
}