-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathindex.js
38 lines (33 loc) · 997 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const VueAutoRoutingPlugin = require('vue-auto-routing/lib/webpack-plugin')
const defaultOptions = {
pages: 'src/pages',
nested: true,
}
module.exports = (api, options) => {
const opts = options.pluginOptions && options.pluginOptions.autoRouting
const pluginOptions = {
...defaultOptions,
...opts,
outFile: (opts && opts.outFile && api.resolve(opts.outFile)) || undefined,
}
api.chainWebpack((webpackConfig) => {
// prettier-ignore
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')
})
}