From 8e543b7526690afc0cfdbaef677fc4cefae9ab8a Mon Sep 17 00:00:00 2001 From: ktsn Date: Sun, 9 Feb 2020 18:33:12 +0800 Subject: [PATCH] docs: update about plugin options --- README.md | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e6325a7..9c5f0af 100644 --- a/README.md +++ b/README.md @@ -140,9 +140,19 @@ The following html will be rendered: ``` -## Options +## Modifying Chunk Name + +A chunk name from auto generated file can be conflicted with your code. You may see the below error log in that case: + +``` + ERROR Failed to compile with 1 errors + error in ./node_modules/vue-auto-routing/index.js +It's not allowed to load an initial chunk on demand. The chunk name "index" is already used by an entrypoint. + ERROR Build failed with errors. +error Command failed with exit code 1. +``` -You can specify options for this plugin under `pluginOptions.autoRouting` in `vue.config.js`. +To avoid this error, you can set `chunkNamePrefix` option to change the auto generated chunk name. ```js // vue.config.js @@ -150,16 +160,30 @@ You can specify options for this plugin under `pluginOptions.autoRouting` in `vu module.exports = { pluginOptions: { autoRouting: { - // Specify vue-cli-plugin-auto-routing options here + // Specify a prefix which will be added to all auto generated chunk name. chunkNamePrefix: 'page-' } } } ``` -The list of options is below: +## Options + +You can specify options for this plugin under `pluginOptions.autoRouting` in `vue.config.js`. The options are simply passed to `vue-auto-routing` options. +You can see the available options list [here](https://github.com/ktsn/vue-route-generator#generateroutesconfig-generateconfig-string). -- `chunkNamePrefix`: Prefix for each route chunk name. You should change this value when your chunk conflicts with generated route chunk name. +```js +// vue.config.js + +module.exports = { + pluginOptions: { + autoRouting: { + // Specify vue-auto-routing options here + nested: false + } + } +} +``` ## Related Projects