shadow-cljs 项目在 proto repl 切换 namespace
按官方文档中的说明已经能正常连接 proto-repl,但是 repl 中不能切换到源码所在的 namespace,不能在开发期间执行业务代码
查看官方文档操作,下面列出简单步骤,加粗为注意事项 https://shadow-cljs.github.io/docs/UsersGuide.html#_proto_repl_atom
添加 proto-repl 依赖
watch 启动,并在浏览器打开页面(如果不打开页面,在 repl 中执行代码会报错:No application has connected to the REPL server. Make sure your JS environment has loaded your compiled ClojureScript code.)
atom 中 proto-repl connect nrepl
proto-repl 中执行 (shadow.cljs.devtools.api/nrepl-select :your-build)
输入 1, shift-enter (检查 namespace)
如果 namespace 是 cljs.user 的话
执行文件头部的 ns
代码块(右键 -> proto-repl -> Execute Block)
; 本来我以为是用 `use` 来切换命名空间,实际上是用 `ns`
(ns 想进入的 namespace
(:require 引用的包))
输入 1, shift-enter(此时 ns 已切换,可以执行文件中的任意代码,也可以访问的 namespace 中的状态、函数)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

下一篇: 谈谈自己对于 AOP 的了解
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论