Skip to content

Commit

Permalink
docs: update about plugin options
Browse files Browse the repository at this point in the history
  • Loading branch information
ktsn committed Feb 9, 2020
1 parent 393a2bd commit 8e543b7
Showing 1 changed file with 29 additions and 5 deletions.
34 changes: 29 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,26 +140,50 @@ The following html will be rendered:
</div>
```

## 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

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

Expand Down

0 comments on commit 8e543b7

Please sign in to comment.