报错一

yarn dev 不报错,build就报错

@vue/runtime-core/dist/runtime-core.d.ts(1795,33): error TS2344: Type 'HostElement' does not satisfy the constraint 'RendererElement'.

 

 解决方式将package.json中的build部分改掉

 改成这个样子就不再报错也可以正常打包了

 

报错二

打包的时候出现以下报错:

warnings when minifying css:
> <stdin>:9:1: warning: "@charset" must be the first rule in the file
9 │ }@charset "UTF-8";

解决方案:修改vite.config.ts文件配置

css部分加上charset: false

完整代码如图

 报错三

vant采用cdn引入的方式报错

Uncaught (in promise) TypeError: Cannot read property 'proxy' of null
at Xe (vant.min.js:1)

 解决方案,换用从vite.config.ts中引入CDN

上面这种报错是在从index.html引入CDN的情况下报错的

 

 

Logo

前往低代码交流专区

更多推荐