I encountered this problem when I added, as in the examples on nuxtjs.org, this lines to my nuxt.config.js
router: {
scrollBehavior: (to, from, savedPosition) => {
return { x: 0, y: 0 }
}
}
When webpack rebuilds the nuxt app, it throws this error
ERROR Failed to compile with 1 errors 11:57:00 AM
error in ./.nuxt/router.js
Syntax Error: Unexpected token, expected ( (13:32)
11 |
12 |
> 13 | const scrollBehavior = function function(to, from, savedPosition) {
| ^
14 | return { x: 0, y: 0 };
15 | }
16 |
@ ./.nuxt/index.js 120:0-43
@ ./.nuxt/client.js
@ multi webpack-hot-middleware/client?name=client&reload=true ./.nuxt/client.js
Obviously breaking everything. I sit a known bug or I've done something wrong myself?
<!--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/c1353">#c1353</a>)</em></sub></div>