An error will be reported when the iview-admin project is moved to another directory

scaffolding downloaded from Github, decompressed and executed after download:

npm install
npm run dev

the completion is normal and can be compiled and run normally.

but putting this directory under my project and then executing it will report an error:

 ERROR  Failed to compile with 1 errors                                                                                         10:06:38

 error  in ./src/router/routers.js

Syntax Error: 
  20 |       hideInMenu: true
  21 |     },
> 22 |     component: () => import("@/view/login/login.vue")
     |                      ^
  23 |   },
  24 |   {
  25 |     path: "/",

Add @babel/plugin-syntax-dynamic-import (https://git.io/vb4Sv) to the "plugins" section of your Babel config to enable parsing.


 @ ./src/router/index.js 3:0-31 9:2-8 35:42-48
 @ ./src/main.js
 @ multi (webpack)-dev-server/client/index.js (webpack)/hot/dev-server.js ./src/main.js

try to find that some directories go wrong and some don"t. It is not clear exactly what caused the problem. Does it have anything to do with the length of the directory?

Local is the Mac OSX system, and nodejs is version 8.11.0.

Apr.02,2021

you need to configure @ babel/plugin-syntax-dynamic-import, the babel plug-in


finally found out that several hidden files in the root directory were not copied.

clipboard.png

Menu