Vue-router: Router base in abtract mode (SSR)

Created on 4 Dec 2016  路  3Comments  路  Source: vuejs/vue-router

When setting a base in the router configuration, on the server-side rendering, router.history.base is an empty string.

It think it's in the abstract constructor that does have the base in argument: https://github.com/vuejs/vue-router/blob/dev/src/history/abstract.js#L10

2.x improvement

Most helpful comment

I think abstract mode should support base, because while it does not care about the address bar, it still can produce urls for links.

All 3 comments

Well, abstract mode was appearantly designed to not care about "base" at all, because it's ... abstract. It was designed with environments that don't care about actual URLs (like a hybrid cordova app) at all since there's no address bar/browser window.

I understand that you use it in nuxt.js's SSR (?), which is not a browser environment, but renders HTML for such an environment - the user's browser. If that'S the case then offering a solution for this scenario would be indeed a good enhancement.

Question is: should we/an we change abstract mode (without breaking changes) or should we rather introduce a new "SSR" mode?

I think abstract mode should support base, because while it does not care about the address bar, it still can produce urls for links.

Agreed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mitar picture mitar  路  3Comments

gil0mendes picture gil0mendes  路  3Comments

rr326 picture rr326  路  3Comments

baijunjie picture baijunjie  路  3Comments

posva picture posva  路  3Comments