当前位置: 首页 > news >正文

使用 devtool 本地调试 nodejs

安装

# 全局安装
$ npm install devtool -g
# 或临时安装
$ npx devtool [file] [opts]

用法

Usage:devtool [入口文件] [opts]Options:--watch, -w             enable file watching (for development) # 动态检测文件变更,不用每次手动重启--quit, -q              quit application on fatal errors--console, -c           redirect console logs to terminal # 将日志打印到命令行--index, -i             specify a different index.html file--poll, -p              enable polling when --watch is given # 轮询--show, -s              show the browser window (default false) # 显示浏览器视窗--headless, -h          do not open the DevTools window # 不使用 devTools 调试窗口--timeout, -t           if specified, will close after X seconds # 超时时间--break                 insert a breakpoint in entry point # 断点调试--config                a path to .devtoolrc config file # 本地配置文件--verbose               verbose Chromium logging--version, -v           log versions of underlying tools--require, -r           require path(s) before running entry--browser-field, --bf   resolve using "browser" field--no-source-maps,--no-sm   disable source map generation--no-node-timers,--no-nt   use browser timers # 使用浏览器中的定时器--no-browser-globals,   --no-bg   removes window,document,navigator from required files

示例

调试一个本地的 index.js 文件

index.js

const test = 'test code';debuggerif(typeof test === 'string') console.log('string');if(typeof test === 'number') console.log('number')

调试上述文件

# 调试 index.js 并且会自动监听文件变更
$ npx devtool index.js -w
http://www.lryc.cn/news/380545.html

相关文章:

  • element-plus 表单组件 之element-form
  • redis持久化主从哨兵分片集群
  • IOS Swift 从入门到精通: 结构体的访问控制、静态属性和惰性
  • SQL题:未完成率较高的50%用户近三个月答卷情况
  • 挑战与机遇的交织
  • Java项目:基于SSM框架实现的精品酒销售管理系统分前后台【ssm+B/S架构+源码+数据库+毕业论文】
  • [论文笔记]Are Large Language Models All You Need for Task-Oriented Dialogue?
  • Django 模版过滤器
  • 计算机组成原理 —— 存储系统(DRAM和SRAM,ROM)
  • 第22篇 Intel FPGA Monitor Program的使用<五>
  • 网信办公布第六批深度合成服务算法备案清单,深兰科技大模型入选
  • ES 8.14 向量搜索优化
  • 查看 MAC 的 shell 配置文件
  • 前端下载文件流,axios设置responseType: arraybuffer/blob无效
  • 动手学深度学习(Pytorch版)代码实践 -卷积神经网络-14模型构造
  • Django 模版转义
  • [数据集][目标检测]药片药丸检测数据集VOC+YOLO格式152张1类别
  • Android SurfaceFlinger——HWC图层合成器加载(四)
  • OpenCV--图像金字塔
  • 创意产业如何应对AI的挑战。
  • 设计模式——工厂方法模式
  • apksigner jarsigner.md
  • 在SQL中使用explode函数展开数组的详细指南
  • JavaScript 预编译与执行机制解析
  • 多路h265监控录放开发-(12)完成全部开始录制和全部停止录制代码
  • Redis源码学习:Redis对象和5种数据类型的工作原理
  • 从理论到实践掌握UML
  • LabVIEW Windows与RT系统的比较与选择
  • docker搭建mongo副本集
  • 关于Pytorch转换为MindSpore的一点建议