-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Make router a separate plugin #4196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
id: `core:${name}`, | ||
apply: loadModule(`@vue/cli-service/generator/${name}`, context) | ||
}) | ||
if (id === 'router') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This if
condition will exist until I make the cli-plugin-vuex
PR.
@LinusBorg @sodatea This is ready for review and merge. |
@@ -112,15 +105,15 @@ vue add vuex | |||
``` json | |||
{ | |||
"useConfigFiles": true, | |||
"router": true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though we now have a standalone router plugin, the legacy preset format (router
and routerHistoryMode
option) can and should still be supported, so as to reduce the migration costs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added support for legacy router option but have it removed from docs completely.
This is now ready for another review. |
if (cliOptions.bare) { | ||
preset.plugins['@vue/cli-service'].bare = true | ||
} | ||
|
||
// legacy support for router | ||
if (preset.router) { | ||
preset.plugins['@vue/cli-plugin-router'] = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to support routerHistoryMode
here.
packages/@vue/cli/lib/options.js
Outdated
@@ -10,8 +10,6 @@ const rcPath = exports.rcPath = getRcPath('.vuerc') | |||
const presetSchema = createSchema(joi => joi.object().keys({ | |||
bare: joi.boolean(), | |||
useConfigFiles: joi.boolean(), | |||
router: joi.boolean(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though not preferred, they should remain in the schema, otherwise the legacy preset format cannot pass the schema validation.
Note: you may leave a TODO: comment here, once @hapi/joi
v16 released, we can update the schema to utilizing its .warn
feature. hapijs/joi@59e60aa
As I tested out, the router plugin does not work well with |
I wanted to add the assert version stuff we recently added to vue but kinda forgot about it. It fixes this issue. |
Addressed your comments. This is now ready for another review. |
@@ -3,9 +3,6 @@ const { toShortPluginId } = require('@vue/cli-shared-utils') | |||
|
|||
exports.getFeatures = (preset) => { | |||
const features = [] | |||
if (preset.router) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only 2 small modifications suggested. |
Updated |
Hey @pksunkara, thank you for your time and effort spent on this PR, contributions like yours help make Vue better for everyone. Cheers! 💚 |
Part of #2335. We remove the
router
option from root options and use it as a plugin as you can see here. This is the actual App.vue template for router which now makes it more consistent over different invoking methods.