Electron 试图将re-frame-10x(was re-frame trace)用于descjop(电子)项目
我正在尝试使用re-frame和electron的组合来建立一个项目,我想安装re-frame-10x,这样我就可以轻松地观看app db的某些部分。我以前在一个通过谷歌浏览器访问的常规clojurescript/re框架项目中使用过它,但现在还没有使用electron。我充满希望,因为我相信electron使用的代码基本上与chrome相同 我按照re-frame-10xGithub页面上的设置说明进行了操作,似乎一切都正常。然而,我无法调用10倍窗口 这是我的project.clj文件的一部分,特别是clojurescript开发版本:Electron 试图将re-frame-10x(was re-frame trace)用于descjop(电子)项目,electron,clojurescript,re-frame,Electron,Clojurescript,Re Frame,我正在尝试使用re-frame和electron的组合来建立一个项目,我想安装re-frame-10x,这样我就可以轻松地观看app db的某些部分。我以前在一个通过谷歌浏览器访问的常规clojurescript/re框架项目中使用过它,但现在还没有使用electron。我充满希望,因为我相信electron使用的代码基本上与chrome相同 我按照re-frame-10xGithub页面上的设置说明进行了操作,似乎一切都正常。然而,我无法调用10倍窗口 这是我的project.clj文件的一部
:cljsbuild
{:builds
{:dev-main {:source-paths ["src"]
:incremental true
:jar true
:assert true
:compiler {:output-to "app/dev/js/cljsbuild-main.js"
:externs ["app/dev/js/externs.js"
"node_modules/closurecompiler-externs/path.js"
"node_modules/closurecompiler-externs/process.js"]
:warnings true
:elide-asserts true
:target :nodejs
:output-dir "app/dev/js/out_main"
:optimizations :simple
:pretty-print true
:output-wrapper true
:closure-defines {"re_frame.trace.trace_enabled_QMARK_" true}
:preloads [day8.re-frame-10x.preload]
:main "anh.core" }}
:dev-front {:source-paths ["src_front" "src_front_profile/anh_front/dev"]
:incremental true
:jar true
:assert true
:compiler {:output-to "app/dev/js/front.js"
:externs ["app/dev/js/externs_front.js"]
:warnings true
:elide-asserts true
:optimizations :none
:output-dir "app/dev/js/out_front"
:pretty-print true
:output-wrapper true }}
请注意,有两个构建。(figwheel状态)告诉我它正在监视并重新编译dev front。dev main包含指向re-frame-10x所需的main的指针
Clojurescript已升级到最新版本“1.10.64”,一切正常,在repl启动(使用emacs中的插孔)或Clojurescript repl启动时没有错误消息
仍然没有重新设置10倍帧窗口的迹象。当我在应用程序窗口中按ctrl-h键时,它应该会出现
这条线下面是我在路上试过的东西。可能无关紧要。
在clojure repl消息中,我看到在启动cljs repl时,re-frame-10x遇到了一些问题:
user> Figwheel: Starting server at http://0.0.0.0:3441
Figwheel: Watching build - dev-front
Figwheel: Cleaning build - dev-front
Compiling "app/dev/js/front.js" from ["src_front" "src_front_profile/anh_front/dev"]...
Failed to compile "app/dev/js/front.js" in 10.853 seconds.
---- Could not Analyze app/dev/js/out_front/day8/re_frame_10x/subs.cljs ----
No such namespace: cljs.spec.alpha, could not locate cljs/spec/alpha.cljs, cljs/spec/alpha.cljc, or Closure namespace "cljs.spec.alpha"
---- Analysis Error : Please see app/dev/js/out_front/day8/re_frame_10x/subs.cljs ----
Launching ClojureScript REPL for build: dev-front
你知道这是什么意思吗?我还没有使用cljs.spec,但编译器似乎正在寻找它
这是project.clj文件的一部分,包含re-frame-10x要求的修改,特别是相关cljsbuild部分编译器部分中的闭包定义、预加载和指向main的链接:
:dev-front {:source-paths ["src_front" "src_front_profile/anh_front/dev"]
:incremental true
:jar true
:assert true
:compiler {:output-to "app/dev/js/front.js"
:externs ["app/dev/js/externs_front.js"]
:warnings true
:elide-asserts true
:optimizations :none
:output-dir "app/dev/js/out_front"
:pretty-print true
:output-wrapper true
:closure-defines {"re_frame.trace.trace_enabled_QMARK_" true}
:preloads [day8.re-frame-10x.preload]
:main "anh.core"
}}
更新:
这有助于:
根据建议,我将clojurescript升级到最新版本,其中包含所需的规范内容,并且当启动cljs repl时,repl显示不同的错误:
Failed to load resource: net::ERR_FILE_NOT_FOUND
cljs_deps.js Failed to load resource: net::ERR_FILE_NOT_FOUND
base.js:677 goog.require could not find: day8.re_frame_10x.preload
goog.logToConsole_ @ base.js:677
base.js:711 Uncaught Error: goog.require could not find: day8.re_frame_10x.preload
at Object.goog.require (base.js:711)
at index.html:11
base.js:677 goog.require could not find: anh.core
goog.logToConsole_ @ base.js:677
base.js:711 Uncaught Error: goog.require could not find: anh.core
at Object.goog.require (base.js:711)
at index.html:11
base.js:677 goog.require could not find: anh_front.init
goog.logToConsole_ @ base.js:677
base.js:711 Uncaught Error: goog.require could not find: anh_front.init
at Object.goog.require (base.js:711)
at index.html:12
这只是找不到的主要功能。project.clj文件指定了2个开发版本:dev-front和dev-main。我把clojurescript编译器选项放在了错误的部分。将它们移动到正确的部分可以消除错误,但当我按ctrl-h键时,re-frame-10x窗口仍然不会出现。解决此问题的关键是将其放入正确的版本中。有2个开发版本,一个用于应用程序本身(dev main),一个用于窗口(dev front)。Dev main可以,也可能应该,单独处理。更改需要在开发人员前端构建中进行 第一步 将开发人员前端构建转换为:优化无。这是re-frame-10x的要求之一。为此,需要将以下内容添加到profile.clj的:dev front:compiler部分下的cljsbuild部分:
:main "setup-front.init"
:asset-path "js/out_front"
html文件可以简化为“setup front.init”,它将为您加载必要的内容。大概是这样的:
<body>
<div id="app">
<p>Minimum app does not work.</p>
</div>
<script type="text/javascript" src="js/front.js" charset="utf-8"></script>
</body>
并将其添加到依赖项中。最好进入:profiles:dev部分。检查说明或clojars以获取最新版本,尽管:
[day8.re-frame/re-frame-10x "0.2.1-SNAPSHOT"]
关于使用这些更改的非常基本的hello world的源代码,请访问
感谢Mike Callahan提供了此解决方案的要点
[day8.re-frame/re-frame-10x "0.2.1-SNAPSHOT"]