问题1:
由于使用的Ts 也没有遵守什么规范,页面报了很多错可以更改编译模式;下图是报错的一个简要信息
解决办法是通过执行其他命令跳过type-check;执行 npm run build-only
"scripts": {
"dev": "vite",
"build": "run-p type-check \"build-only {@}\" --",
"preview": "vite preview",
"build-only": "vite build",
"type-check": "vue-tsc --build --force",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
"format": "prettier --write src/"
},
问题2:
这个错误信息是因为我比较喜欢使用 console.log
在webstorm中喜欢 .log
的代码片段导致导入了node的核心包错误,如果你也出现这样的错误,可以看一下是否导入了核心包的内容
[vite]: Rollup failed to resolve import "fsevents" from "D:/development/project/my/Golang/RoccBlog/Fornt/node_modules/rollup/dist/es/shared/node-entry.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`