html文件中引入.ts文件并运行

问题: 一个项目,是用TypeScript编写的,但是html中引入了.ts文件后报错了,有没有办法跳过tsc这个编译命令,不然每次都需要Tsc编译一下后再启动,有点麻烦

html 复制代码
<!doctype html>
<html lang="zh-CN">

<head>
    <title></title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <link rel="shortcut icon" href="./resource/images/favicon.ico" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <!-- 这种使用方法 -->
    <script src="demo.ts"></script>
</head>
<body>
    <div id="app">
        <div class="demo1">测试</div>
    </div>
</body>
<html>
</html>
</html>
复制代码
npm install parcel@next

安装成功之后,在package.json中配置一个启动命令,比如

 "scripts": {
	"start":"parcel ./src/index.html"
 }
相关推荐
李姆斯5 小时前
为啥Agent在coding表现这么好,但是在别的领域就是差的不少?
前端·agent·ai编程
鱼与宇7 小时前
前端Web(html+css+js+vue3)
前端
雪芽蓝域zzs9 小时前
(六)打包优化 + Nginx 部署完整配置 + 项目收尾
前端·vue.js
研☆香9 小时前
聊一聊前端的常见字 关键字
开发语言·前端·javascript
东风破_9 小时前
JWT 1:从一个登录请求开始,理解 React 项目里的 API 层与 Mock
前端·后端
东风破_9 小时前
JWT 3:为什么 Token 要放进 Authorization?Axios 拦截器到底解决了什么?
前端·后端
东风破_9 小时前
JWT 5:路由守卫是什么?把整个 JWT 登录鉴权流程串起来
前端·后端
东风破_9 小时前
JWT 2:HTTP 是无状态的,为什么登录成功后还要给 Token?
前端·后端
东风破_9 小时前
JWT 4:Zustand 到底解决了什么?为什么登录状态要放进 Store?
前端·后端
IT_陈寒9 小时前
Vite动态导入差点让我秃头,原来问题出在这
前端·人工智能·后端