For this Vue3 + TS + Element Plus project, an error message appeared when importing and using the ElMessage module of Element Plus.
Module ""element-plus"" has no exported member "ElMessage". Do you mean to use "import ElMessage from "element-plus"" instead?
After searching the Internet for a long time, I didn't find a complete and feasible solution, so write one yourself.
problem analysis:
Because TS is used in the project, and TS cannot recognize the modules exposed by Element Plus.
solution:
(1) Add a new line of code in both tsconfig.app.json and tsconfig.node.json files.
"moduleResolution": "node",
(2) Add the following code in env.d.ts (you can ignore this operation if the problem is solved after completing the above operation)
declare module 'element-plus';
So far, there will be no wavy line prompt, although this error prompt does not seem to affect the operation and use of the project.