UNPKG

vue-cli-plugin-cobra-router

Version:

Vue CLI plugin, Support automatic generation of international routing table and dynamic update of meta information

36 lines (30 loc) 912 B
const VueAutoRoutingPlugin = require('vue-auto-routing/lib/webpack-plugin') const defaultOptions = { pages: 'src/pages', nested: true, } module.exports = (api, options) => { const pluginOptions = { ...defaultOptions, ...(options.pluginOptions && options.pluginOptions.autoRouting), } api.chainWebpack((webpackConfig) => { webpackConfig .plugin('vue-auto-routing') .use(VueAutoRoutingPlugin, [pluginOptions]) // prettier-ignore webpackConfig.module .rule('route-meta') .post() .resourceQuery(/blockType=route-meta/) .use('route-meta') .loader('vue-cli-plugin-auto-routing/route-loader') // prettier-ignore webpackConfig.module .rule('route') .post() .resourceQuery(/blockType=route/) .use('route') .loader('vue-cli-plugin-auto-routing/route-loader') }) }