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的更多相关文章

  1. 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=/ ...

  2. pg_upgrade升级报错:Only the install user can be defined in the new cluster

    前两天pg11刚出来,打算测试一下,想将测试库升级到pg11,之前测试库的版本是pg9.6,后面我将它升到了pg10,打算在pg10的版本基础上升级到pg11. 但执行时,多次报出: Performi ...

  3. 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. ...

  4. 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 ...

  5. 手动编译源码安装包报错 fatal error:cruses.h: no such file or direcrory

    很明显是缺少cruses.h这个文件,但是用yum搜索又搜不到,可能是我的yum源的库包太少的原因吧. 后来多方查找,发现cruses.h这个头文件属于ncurses模块,需要安装ncurses-de ...

  6. 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 ...

  7. Spring AOP 报错:Error creating bean with name 'student' defined in file

    问题概述 Spring AOP 报错,一直显示:Error creating bean with name 'student' defined in file 的报错.从五个方向排查:第一,aspec ...

  8. 解决vuex“状态管理调用报错”报错为:"Uncaught ReferenceError: mapactions is not defined"

    报错: 源码: <script> import Vuex from 'vuex'; import {mapActions,mapGetters} from 'vuex'; // conso ...

  9. 解决未定义的count键“报错为:"Uncaught ReferenceError: count is not defined"

    报错: 源码:Vuex仓库.js let state = {     count } export default state   解决:未赋值的count键

  10. Linux程序设计中的curses.h编译报错,无法找到curses.h和ncurses.h

    源程序screen.c如下: #include <stdio.h> #include <term.h> #include <curses.h> #include & ...

随机推荐

  1. OData – 大杂烩

    前言 本篇记入一些 OData 的小东西. Query string too long OData 使用 GET 请求,然后搭配 query string $filter, $select, $exp ...

  2. Vs Code, Visual Studio 2022, Angular and Live Server Running Through Https and IP Address

    前言 之前就写过 angular cli, vs code liveserver, vs 2019 iis express 10, vs code kestrel 使用 https + ip. 但写的 ...

  3. QT6框架也能开发Web浏览器应用程序:QT6框架如何编译运行测试WebAssembly应用程序?

    QT6框架也能开发Web浏览器应用程序:QT6框架如何编译运行测试WebAssembly应用程序? 简介 本文将介绍如何使用QT6框架开发Web浏览器应用程序,并介绍具体的编译运行测试WebAssem ...

  4. WebRTC 初探

    背景 我正在实现一个 FC 游戏网站, PC 用户仅需要配置键盘便能实现小伙伴们一起玩, 但是手机用户就比较麻烦了 传统的网页游戏都是通过 HTTP/WS 的方式实现联机, 对于服务器的负担还是比较重 ...

  5. “全栈合一 智慧运维”智和网管平台SugarNMS V9版本发布

    以"管控万物 无所不能 无处不"在为产品创新理念,智和信通打造"全栈式"网络安全运维平台-智和网管平台SugarNMS.立足数字化.智能化.可视化.自动化,整合 ...

  6. Windows Server 2012 R2安装JDK7报错:内部错误61003

    按顺序安装 1)KB2919442补丁(https://www.microsoft.com/zh-cn/download/details.aspx?id=42153) 2)KB2919355补丁(ht ...

  7. 云原生周刊:HashiCorp Vault 1.14 发布 | 2023.6.26

    开源项目推荐 Helmfile Helmfile 是一个开源工具,使用 Helm charts 简化复杂应用程序的部署.它提供了一种声明性的方式来定义 Kubernetes 资源的期望状态,并管理 H ...

  8. 线上debug&gateway自定义路由规则

    如何进行线上debug. 如何在gateway自定义路由规则去进行请求分发,让请求打到集群模式下我们想要的节点. 1.配置remote debug 1.在启动参数配置参数: -Xdebug -Xrun ...

  9. OpenCV3 图像处理笔记

    此笔记针对 Python 版本的 opencv3,c++ 版本的函数和 python 版本的函数参数几乎一样,只是矩阵格式从 ndarray 类型变成适合 c++ 的 mat 模板类型.注意,因为 p ...

  10. 【JVM第3课】运行时数据区

    运行时数据区结构图如下: 可分为 5 个区域,分别是方法区.堆区.虚拟机栈.本地方法栈.程序计数器.这里大概介绍一下各个模块的作用,会在后面的文章展开讲. 类加载子系统会把类信息加载到方法区,程序运行 ...