首页 > 建站教程 > 前端框架 >  Cannot find module 'vite'. Did you mean to set the 'moduleResolution' option正文

Cannot find module 'vite'. Did you mean to set the 'moduleResolution' option

vite+ts项目,到处提示:

Cannot find module 'vite'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?

Cannot find module '@vitejs/plugin-vue'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?

Bundler: This is the recommended setting in TypeScript 5.0+ for applications that use a bundler

Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.

等等:

vite

只需要改个配置即可,根目录 tsconfig.node.json,将:

"moduleResolution": "Bundler",

改为

"moduleResolution": "Node",

保存,就不会报错了。