@road-to-rome/webpack-plugin
v0.12.2
Published
Automatically generate routes by filename
Maintainers
Readme
@road-to-rome/webpack-plugin
Automatically generate routes by filename.
Installation
npm install @road-to-rome/routes --save
npm install @road-to-rome/webpack-plugin --save-devUsage
// example: 'src/index.js'
import { routes } from '@road-to-rome/routes';
const router = new Router({ routes });// example: webpack.config.js
const RoadToRomePlugin = require('@road-to-rome/webpack-plugin');
module.exports = {
plugins: [new RoadToRomePlugin()]
};Options
globs
- type:
string - default:
src/pages/**/route.config.js
Find your routes by globs.
depth
- type:
integer - default:
10
Value of globbyOptions.deep and chokidarOptions.depth
filter
- type:
function: ({ path }) => boolean
Page component filter for generations.
include
- type:
string[]
Page component filter for generations.
exclude
- type:
string[]
Page component filter for generations.
Tips
When your webpack compiler in watching mode, typing rtr command in your terminal can trigger routes rebuild manually.
