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"
 }
相关推荐
踩着两条虫40 分钟前
「AI + 低代码」的可视化设计器
开发语言·前端·低代码·设计模式·架构
Jagger_1 小时前
项目上线忙碌结束之后,为什么总想找点事做?
前端
GalenZhang8881 小时前
OpenClaw 配置多个飞书账号实战指南
前端·chrome·飞书·openclaw
steven~~~2 小时前
为什么mq报错
javascript
萌新小码农‍2 小时前
python装饰器
开发语言·前端·python
threelab3 小时前
Three.js 初中数学函数可视化 | 三维可视化 / AI 提示词
开发语言·前端·javascript·人工智能·3d·着色器
爱学习的程序媛3 小时前
浏览器工作原理全景解析
前端·浏览器·web
凉辰3 小时前
解决 H5 键盘遮挡与页面上推
开发语言·javascript·计算机外设
我是若尘4 小时前
用 Git Worktree 同时开多个需求,不用来回 stash
前端
IT_陈寒5 小时前
Vue的v-for为什么不加key也能工作?我差点翻车
前端·人工智能·后端