nuxt: [2.4.0] Update breaks nested page loading

Version

v2.4.0

Reproduction link

https://codesandbox.io/s/7mowyo1vnj

Steps to reproduce

After upgrading to 2.4.0 using yarn I get the following error:

 ERROR  Failed to compile with 1 errors                                                                                                                                             friendly-errors 00:37:35

This dependency was not found:                                                                                                                                                      friendly-errors 00:37:35
                                                                                                                                                                                    friendly-errors 00:37:35
* ..\pages\user\login.vue in ./.nuxt/router.js                                                                                                                                      friendly-errors 00:37:35
                                                                                                                                                                                   friendly-errors 00:37:35
To install it, you can run: npm install --save ..\pages\user\login.vue                                                                                                              friendly-errors 00:37:35

I have to say that the page in the error changes every time but is always a nested one.

router.js

import Vue from 'vue'
import Router from 'vue-router'
import { interopDefault } from './utils'

const _3c4810c7 = () => interopDefault(import('..\\pages\\about.vue' /* webpackChunkName: "pages_about" */))
const _390705aa = () => interopDefault(import('..\\pages\\blog\\index.vue' /* webpackChunkName: "pages_blog_index" */))
const _9f25118c = () => interopDefault(import('..\\pages\\Contact.vue' /* webpackChunkName: "pages_Contact" */))
const _42e82e10 = () => interopDefault(import('..\\pages\\user\\login.vue' /* webpackChunkName: "pages_user_login" */))
const _66626178 = () => interopDefault(import('..\\pages\\user\\profile.vue' /* webpackChunkName: "pages_user_profile" */))
const _45912ae4 = () => interopDefault(import('..\\pages\\user\\reset\\index.vue' /* webpackChunkName: "pages_user_reset_index" */))
(...)

I tried deleting the .nuxt, .node_modules and yarn.lock and run yarn install && yarn run dev but the error persists.

What is expected ?

Nested routes to work as they used to in prior versions

What is actually happening?

They don’t work. I get “This dependency was not found” instead.

Additional comments?

I will try to create a reproduction repo in the next couple of days, unless someone else does. I tried to use CodeSandbox to create one but I think it fails due to a different reason (a codesandbox problem I believe - error: Cannot find module ‘./components/nuxt-link.server.js’).

<div align="right">This bug report is available on Nuxt community (#c8556)</div>

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 22 (8 by maintainers)

Most upvoted comments

Not sure if this is a related issue or not but I have this issue after upgrading to 2.4.2. What to do?

 ERROR  Failed to compile with 1 errors                                                                                                                                          friendly-errors 21:39:22


 ERROR  in ./.nuxt/router.js                                                                                                                                                     friendly-errors 21:39:22

Module parse failed: Unexpected token (6:24)                                                                                                                                     friendly-errors 21:39:22
You may need an appropriate loader to handle this file type.
| 
| var _2ade856f = function _2ade856f() {
>   return interopDefault(import('../pages/auth.vue'
|   /* webpackChunkName: "pages/auth" */
|   ));

UPDATE

The error only comes with Nuxt.js 2.4.2 and NPM npm run dev. I have also tried yarn run dev and the above error is not there.

Let’s track the issue in #4900