1. import path from 'path' 时 ts 报错:模块 ""path"" 只能在使用 "allowSyntheticDefaultImports" 标志时进行默认导入。
在 tsconfig.node.json 文件的 compilerOptions 添加配置 "allowSyntheticDefaultImports": true

2. main.ts 文件报错:Cannot find module ‘vue’. Did you mean to set the ‘moduleResolution’ option to ‘node’, or to add aliases to the ‘paths’ option?
tsconfig.app.json 文件报错:在没有 “node” 模块解析策略的情况下,无法指定选项 “-resolveJsonModule”。


解决办法:
在 tsconfig.app.json 文件的 compilerOptions 下配置 "moduleResolution": "node" 就可以了。这将告诉TypeScript使用Node.js的模块解析方式来查找模块。
配置已经加了,但引入 vue-router 地方的报错还在:

这时你可以重启一下VSCode就不会报错了。













![C国演义 [第三章]](https://img-blog.csdnimg.cn/48fe918b9d0c4f47a9e5a56a7a3aa117.png)





