diff --git a/lib/nuxt.js b/lib/nuxt.js index 89d89718aa..6415885000 100644 --- a/lib/nuxt.js +++ b/lib/nuxt.js @@ -42,6 +42,7 @@ class Nuxt { router: { mode: 'history', base: '/', + userSpecifiedBase: false, middleware: [], linkActiveClass: 'nuxt-link-active', linkExactActiveClass: 'nuxt-link-exact-active', @@ -62,6 +63,7 @@ class Nuxt { // Sanitization if (options.loading === true) delete options.loading if (options.router && typeof options.router.middleware === 'string') options.router.middleware = [ options.router.middleware ] + if (options.router && typeof options.router.base === 'string') options.router.userSpecifiedBase = true if (typeof options.transition === 'string') options.transition = { name: options.transition } this.options = _.defaultsDeep(options, defaults) // Env variables diff --git a/lib/render.js b/lib/render.js index 4864a0f4d2..66d7fbf960 100644 --- a/lib/render.js +++ b/lib/render.js @@ -94,7 +94,9 @@ export async function renderRoute (url, context = {}) { } const m = context.meta.inject() let HEAD = m.meta.text() + m.title.text() + m.link.text() + m.style.text() + m.script.text() + m.noscript.text() - HEAD += `` + if (self.options.router.userSpecifiedBase) { + HEAD += `` + } HEAD += context.renderResourceHints() + context.renderStyles() APP += `` APP += context.renderScripts()