1. pnpm creates vite+vue3.0+ts project

1. cmd opens the command window

2、pnpm create vite

3. Set a project name, press Enter, it will appear, select the project framework, here choose to create a vue project, (press the up and down keys to select, press the Enter key to select)

4. Choose typescript here

5. The project is successfully created, cd apply: the directory is defined under the apply directory, apply is the project name set in the third step, and a folder will be generated

                pnpm install : project initialization

                pnpm run serve : run the project

 

 Sometimes, the operation is successful, and no error is reported when running and compiling, but when clicking a single file to enter, an error will be reported

Problem 1: Some dependencies cannot be found

Solution: Modify moduleResolution in tsconfig.json and change it to node, which means looking for dependencies from node

[moduleResolution, defines the process that the compiler follows when looking for the content of the imported module, that is, where to find the imported dependencies. For details, please see: Module Resolution · TypeScript Chinese Network · TypeScript - a superset of JavaScript


Question 2: Vetur, plug-in, error message, vue3.0, recommendedvolar,volar是vetur的升级版,能更好的支持ts。

Solved: 禁用Vetur, install or enablevolar,并重启开发工具,我用的是vscode开发,我需要重启vscode


Guess you like

Origin blog.csdn.net/qq_23135259/article/details/130366121