Static GitHub Issues

[1664] import router from '~router' stopped working

prev: Nuxt.js Bug, Help!
next: Get Authentication by Django POST API

Hello. I had a fix for scrolling to top behavior when page transition, but with latest Nuxt releases it stoped working. It was a plugin:

import router from '~router'

router.afterEach((to, from) => {
  setTimeout(() => {
    if (document) document.body.scrollTop = 0
  }, 515)
})

But now this import router from '~router' gives me an error.

Any tips how to fix it? How to access router with latest API?

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c1489">#c1489</a>)</em></sub></div>