From d83761028e5186a3716890cca4c9b89c649ef14d Mon Sep 17 00:00:00 2001 From: "Xin Du (Clark)" Date: Tue, 26 Nov 2019 22:41:19 +0000 Subject: [PATCH] feat(vue-app): upgrade `vue-router` to 3.1.x (#6722) --- distributions/nuxt-start/package.json | 2 +- packages/vue-app/package.json | 2 +- packages/vue-app/template/router.js | 7 +++++++ renovate.json | 1 - test/unit/unicode-base.size-limit.test.js | 2 +- yarn.lock | 8 ++++---- 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/distributions/nuxt-start/package.json b/distributions/nuxt-start/package.json index 9d060566f3..9bdf2847cc 100644 --- a/distributions/nuxt-start/package.json +++ b/distributions/nuxt-start/package.json @@ -62,7 +62,7 @@ "vue-client-only": "^2.0.0", "vue-meta": "^2.3.1", "vue-no-ssr": "^1.1.1", - "vue-router": "~3.0.7", + "vue-router": "^3.1.3", "vuex": "^3.1.2" }, "engines": { diff --git a/packages/vue-app/package.json b/packages/vue-app/package.json index 3036d9ce81..d9019f6d92 100644 --- a/packages/vue-app/package.json +++ b/packages/vue-app/package.json @@ -18,7 +18,7 @@ "vue-client-only": "^2.0.0", "vue-meta": "^2.3.1", "vue-no-ssr": "^1.1.1", - "vue-router": "~3.0.7", + "vue-router": "^3.1.3", "vue-template-compiler": "^2.6.10", "vuex": "^3.1.2" }, diff --git a/packages/vue-app/template/router.js b/packages/vue-app/template/router.js index 3bef287041..1f4dae9c40 100644 --- a/packages/vue-app/template/router.js +++ b/packages/vue-app/template/router.js @@ -82,6 +82,13 @@ const _routes = recursiveRoutes(router.routes, ' ', _components, 1) } }).join('\n')%> +// TODO: remove in Nuxt 3 +const emptyFn = () => {} +const originalPush = Router.prototype.push +Router.prototype.push = function push (location, onComplete = emptyFn, onAbort) { + return originalPush.call(this, location, onComplete, onAbort) +} + Vue.use(Router) export const routerOptions = { diff --git a/renovate.json b/renovate.json index 35bc4b1220..f7dd50aebb 100644 --- a/renovate.json +++ b/renovate.json @@ -7,7 +7,6 @@ ], "ignoreDeps": [ "core-js", - "vue-router", "memory-fs" ], "lockFileMaintenance": { diff --git a/test/unit/unicode-base.size-limit.test.js b/test/unit/unicode-base.size-limit.test.js index e50d676bf7..7a6b1b4458 100644 --- a/test/unit/unicode-base.size-limit.test.js +++ b/test/unit/unicode-base.size-limit.test.js @@ -21,7 +21,7 @@ describe('nuxt minimal vue-app bundle size limit', () => { const filter = filename => filename === 'vue-app.nuxt.js' const legacyResourcesSize = await getResourcesSize(distDir, 'client', { filter }) - const LEGACY_JS_RESOURCES_KB_SIZE = 15.2 + const LEGACY_JS_RESOURCES_KB_SIZE = 15.4 expect(legacyResourcesSize.uncompressed).toBeWithinSize(LEGACY_JS_RESOURCES_KB_SIZE) }) }) diff --git a/yarn.lock b/yarn.lock index e6749f7335..ee10f60c74 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11820,10 +11820,10 @@ vue-no-ssr@^1.1.1: resolved "https://registry.npmjs.org/vue-no-ssr/-/vue-no-ssr-1.1.1.tgz#875f3be6fb0ae41568a837f3ac1a80eaa137b998" integrity sha512-ZMjqRpWabMPqPc7gIrG0Nw6vRf1+itwf0Itft7LbMXs2g3Zs/NFmevjZGN1x7K3Q95GmIjWbQZTVerxiBxI+0g== -vue-router@~3.0.7: - version "3.0.7" - resolved "https://registry.npmjs.org/vue-router/-/vue-router-3.0.7.tgz#b36ca107b4acb8ff5bc4ff824584059c23fcb87b" - integrity sha512-utJ+QR3YlIC/6x6xq17UMXeAfxEvXA0VKD3PiSio7hBOZNusA1jXcbxZxVEfJunLp48oonjTepY8ORoIlRx/EQ== +vue-router@^3.1.3: + version "3.1.3" + resolved "https://registry.npmjs.org/vue-router/-/vue-router-3.1.3.tgz#e6b14fabc0c0ee9fda0e2cbbda74b350e28e412b" + integrity sha512-8iSa4mGNXBjyuSZFCCO4fiKfvzqk+mhL0lnKuGcQtO1eoj8nq3CmbEG8FwK5QqoqwDgsjsf1GDuisDX4cdb/aQ== vue-server-renderer@^2.6.10: version "2.6.10"