uniapp+vite+ts+express踩坑总结

1 关于引入express包报

import express from "express";

^^^^^^

SyntaxError: Cannot use import statement outside a module的问题。

解决方案:

在package.json中添加type:"module"选项

2 'Response' is a type and must be imported using a type-only import when 'preserveValueImports' and 'isolatedModules' are both enabled.报错

解决方案:给 { NextFunction,Request,Response } 添加 type 关键词

复制代码
import  type { NextFunction,Request,Response } from "express"
相关推荐
万少7 小时前
HarmonyOS 开发必会 5 种 Builder 详解
前端·harmonyos
橙序员小站9 小时前
Agent Skill 是什么?一文讲透 Agent Skill 的设计与实现
前端·后端
炫饭第一名11 小时前
速通Canvas指北🦮——基础入门篇
前端·javascript·程序员
王晓枫12 小时前
flutter接入三方库运行报错:Error running pod install
前端·flutter
符方昊12 小时前
React 19 对比 React 16 新特性解析
前端·react.js
ssshooter12 小时前
又被 Safari 差异坑了:textContent 拿到的值居然没换行?
前端
曲折12 小时前
Cesium-气象要素PNG色斑图叠加
前端·cesium
Forever7_12 小时前
Electron 淘汰!新的桌面端框架 更强大、更轻量化
前端·vue.js
Angelial12 小时前
Vue3 嵌套路由 KeepAlive:动态缓存与反向配置方案
前端·vue.js
jiayu13 小时前
Angular学习笔记24:Angular 响应式表单 FormArray 与 FormGroup 相互嵌套
前端