Home  >  Q&A  >  body text

javascript - webpack compiles vue project and throws a warning. This has not happened before

The error message is as follows:
Critical dependency: the request of a dependency is an expression

The routing code is as follows:

routes: [
    {
      path: '/login',
      name: 'login',
      component: resolve => require(['./../views/login/login.vue', resolve])
    },
    {
      path: '/404',
      name: '404',
      component: resolve => require(['./../views/404.vue', resolve])
    }
  ]

I have written this before, but this has never happened. Please solve it

phpcn_u1582phpcn_u15822663 days ago1039

reply all(1)I'll reply

  • 怪我咯

    怪我咯2017-07-05 11:02:24

    There is indeed nothing wrong with writing it this way. It may be that the warning mechanism has been changed in the version update.
    Expressions can be made into constants for easy reading and modification

    reply
    0
  • Cancelreply