vite2+vue3使用tsx报错React is not defined、h is not defined
vite 为 .jsx 和 .tsx 文件提供开箱即用支持。
如果不是在 react 中使用 jsx,对于报错:
React is not defined
需要在 vite.config.js 文件中添加如下配置:
export default {
esbuild: {
jsxFactory: 'h',
jsxFragment: 'Fragment'
}
}
此时重新启动项目如有报错:
h is not defined
需要在 .jsx 或 .tsx 文件中手动引入 import { h } from 'vue';
或者使用vite的注入helper自动引入 h :
export default {
esbuild: {
jsxInject: "import { h } from 'vue';"
}
}
vite2+vue3使用tsx报错React is not defined、h is not defined的更多相关文章
- PHP编译安装报错:configure: error: mcrypt.h not found. Please reinstall libmcrypt
我是在CentOS6.5安装php5.5.28这个版本,PHP编译代码如下: ./configure --prefix=/usr/local/php --with-config-file-path=/ ...
- pg_upgrade升级报错:Only the install user can be defined in the new cluster
前两天pg11刚出来,打算测试一下,想将测试库升级到pg11,之前测试库的版本是pg9.6,后面我将它升到了pg10,打算在pg10的版本基础上升级到pg11. 但执行时,多次报出: Performi ...
- Spring Boot2.1.7启动zipkin-server报错:Error creating bean with name 'armeriaServer' defined in class path
修改项目,更新组件版本时,引入了最新版本2.12.9的zipkin-server和zipkin-autoconfigure-ui时,服务启动报错: org.springframework.beans. ...
- mac 安装 报错 "/usr/local/include/stdint.h:2:10: error: #include nested too deeply"
报错详细信息 构建错误 - “#include嵌套太深” /usr/local/include/stdint.h:2:10: error: #include nested too deeply #in ...
- 手动编译源码安装包报错 fatal error:cruses.h: no such file or direcrory
很明显是缺少cruses.h这个文件,但是用yum搜索又搜不到,可能是我的yum源的库包太少的原因吧. 后来多方查找,发现cruses.h这个头文件属于ncurses模块,需要安装ncurses-de ...
- Mac安装Mysql-python遇到的坑,被这俩报错反复摩擦:'my_config.h' file not found 和 IndexError: string index out of range
最后Stackoverflow上面的大神解决了问题: Link brew install mysql brew unlink mysql brew install mysql-connector-c ...
- Spring AOP 报错:Error creating bean with name 'student' defined in file
问题概述 Spring AOP 报错,一直显示:Error creating bean with name 'student' defined in file 的报错.从五个方向排查:第一,aspec ...
- 解决vuex“状态管理调用报错”报错为:"Uncaught ReferenceError: mapactions is not defined"
报错: 源码: <script> import Vuex from 'vuex'; import {mapActions,mapGetters} from 'vuex'; // conso ...
- 解决未定义的count键“报错为:"Uncaught ReferenceError: count is not defined"
报错: 源码:Vuex仓库.js let state = { count } export default state 解决:未赋值的count键
- Linux程序设计中的curses.h编译报错,无法找到curses.h和ncurses.h
源程序screen.c如下: #include <stdio.h> #include <term.h> #include <curses.h> #include & ...
随机推荐
- EF Core – QueryFilter & Interception
主要参考 Global Query Filters Interceptors QueryFilter QueryFilter 就是默认过滤, 非常适合用来做 Soft Delete builder.H ...
- ScanFormer:逐层抵达目标,基于特征金字塔的指代表达理解框架 | CVPR'24
指代表达理解(REC)旨在在图像中定位由自由形式自然语言描述指定的目标对象.尽管最先进的方法取得了令人印象深刻的性能,但它们对图像进行了密集感知,包含与语言查询无关的多余视觉区域,导致额外的计算开销. ...
- git工具:sourcetree使用中的部分问题
这段时间经常用到这个工具.就当记个笔记,记录一下我的一些问题. 问题一: 如果想要拉取远端更新: 第一步:先登陆sourcetree,点击"抓取". 第二步:在终端输入:git s ...
- 王树森Attention与Self-Attention学习笔记
目录 Seq2Seq + Attention Attention的原理 方法一(Used in the original paper) 方法二(more popular,the same to Tra ...
- 微软nuget国内源
https://www.cnblogs.com/Leo_wl/p/16328650.html 为解决国内访问NuGet服务器速度不稳定的问题 ,这里推荐使用NuGet微软官方中国国内镜像 地址:htt ...
- 史上最全ThreadLocal 详解
概述 线程本地变量.当使用 ThreadLocal 维护变量时, ThreadLocal 为每个使用该变量的线程提供独立的变量副本,所以每一个线程都可以独立地改变自己的副本,而不会影响其它线程. 每个 ...
- Selenium实现元素定位
Selenium提供了定位元素的方法find_element(),该方法被定义在WebDriver类中. 一.参数 1.两个参数,参数1根据不同定位方法确定,定位方法如下: (1)通过id定位:使用参 ...
- 对背包dp的再探究:以 采药 和 疯狂的采药 为例
题目链接: 01背包:采药 完全背包:疯狂的采药 关于 "总体积刚好是 V " 和 "总体积 \(\le\) V " 正常的背包推导的都是 "总体积刚 ...
- luogu P3842 [TJOI2007] 线段
link 好题,考虑如何设定状态. 设\(dp_{i,0/1}\)表示到了第\(i\)行走完后停在这一行的最左侧/最右侧. 设定\(l_i\)表示这一行该线段的最左侧,\(r_i\)表示这一行的最右侧 ...
- 强化学习:如何计算被环境系统截断的terminated state的value值 —— (Bootstrap returns from value estimates if episode is terminated by timeout)
本文主题:如何计算强化学习中被环境系统截断的terminated state的value值 首先解释一下什么是强化学习中的terminated state的value值,强化学习就是一个智能体(age ...