[Solved] Error: Cannot find module ‘@/views/xxx‘ at webpackEmptyContext

When you clone a Vue project from the open source platform, it is reported that the corresponding module cannot be found after logging in.

After searching a lot, it was finally solved.

export const loadView = (view) => {
  return () => import(`@/views/${view}`)
}

Change to the following

export const loadView = (view) => {
  return (resolve) => require([`@/views/${view}`], resolve)
}

It can be solved.

Cause: there is a problem with the webpack version. Dynamic import in webpack 4 does not support variable mode

The project can be seen in the elephant template.

Read More: