# yc-vue-route-plugin

> ### 介绍

Latest version **1.0.5** (published 2021-08-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install yc-vue-route-plugin
pnpm add yc-vue-route-plugin
yarn add yc-vue-route-plugin
bun add yc-vue-route-plugin
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2021-08-17 |
| First published | 2021-08-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | yc |
| Maintainers | yc199609 |

## Links

- npm: https://www.npmjs.com/package/yc-vue-route-plugin
- Repository: https://gitee.com/great_yc/yc-vue-route-plugin
- npm.io page: https://npm.io/package/yc-vue-route-plugin

## Dependencies (2)

- [chalk](https://npm.io/package/chalk.md) ^4.1.2
- [chokidar](https://npm.io/package/chokidar.md) ^3.5.2

## Recent versions

- 1.0.5 (latest) — 2021-08-17
- 1.0.4 — 2021-08-17
- 1.0.3 — 2021-08-14
- 1.0.2 — 2021-08-14
- 1.0.1 — 2021-08-14
- 1.0.0 — 2021-08-13

## README

# yc-vue-route-plugin

### 介绍

扫描项目中`vue`文件的路由配置并生成路由文件的一款 webpack 插件。

### 使用方式

#### 快速尝试
在仓库中有一个 `example` 目录，你可以将本项目克隆到本地后，进入到该目录下，执行：
```
$ yarn install
// 然后执行
$ yarn start 
// 或 
$ yarn build
```

执行完上述命令后，你就可以在`src/router/`目录下看到自动生成的路由文件了。
你可以自行修改`pages`目录中的文件查看编译后的路由改动结果。

#### 安装
```bash
$ yarn add -D yc-vue-route-plugin
```

#### 配置
在`vue.config.js`或在`webpack`配置文件中加入插件配置：
```js
const VueRouteWebpackPlugin = require("yc-vue-route-plugin");

module.exports = {
  configureWebpack: {
    plugins: [
      new VueRouteWebpackPlugin({
        // 选项，见下文
        filePath: path.join(__dirname, './src/pages'),
      	routePath: path.join(__dirname, './src/router/index.js')
      })
    ],
  }
};
```

#### 选项参考

插件提供了以下这些选项供自定义配置
```js
new VueRouteWebpackPlugin({
  // 插件扫描的项目目录，绝对路径
  filePath: path.join(__dirname, './src/pages'),
  // 生成的路由文件存放地址，绝对路径
  routePath: path.join(__dirname, './src/router/index.js'),
  // 是否使用vue3模版，默认false
  isVue3: true,
  // 是否使用history路由，默认false
  isHistory: true,
})
```

---
_Source: https://npm.io/package/yc-vue-route-plugin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
