Home

Issue: 1516

Scrollbehavior breaks execution

[issue link]

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?

This question is available on Nuxt.js community (#c1353)