简体   繁体   English

如何在不需要Figwheel的情况下部署试剂应用程序?

[英]How can I deploy a Reagent application, without needing Figwheel?

I wrote a web application in Reagent, and I develop and run it locally using Figwheel, which is great. 我在Reagent中编写了一个Web应用程序,我使用Figwheel在本地开发和运行它,这很棒。 Now I want to deploy it, so I ran "lein ring uberwar". 现在我想部署它,所以我跑了“lein ring uberwar”。 It says "Compiling ClojureScript..." (3 times!), which sounds promising. 它说“编译ClojureScript ......”(3次!),听起来很有希望。 But then when I deploy the war file and visit the page, I get a flash of: 但是当我部署war文件并访问该页面时,我得到一个闪光:

ClojureScript has not been compiled!
please run lein figwheel in order to start the compiler

before the application kicks in. 在申请开始之前。

Should Figwheel even be involved in production deploys? Figwheel甚至应该参与生产部署吗? Can I build an uberwar that doesn't have this FOUC-like flash? 我可以建立一个没有这种类似FOUC闪光灯的超级战争吗?

I found How do I deploy a single-page app. 我发现如何部署单页应用程序。 written in ClojureScript / Figwheel to a static server? 用ClojureScript / Figwheel写成静态服务器? but it seems to start from scratch (not Reagent-specific), and a lot of the links are dead. 但它似乎从头开始(不是Reagent特定的),很多链接已经死了。

I'm not familiar with how figwheel/uberwar work so I don't even know what to try. 我不熟悉figwheel / uberwar如何工作,所以我甚至不知道该尝试什么。

This happens even with a plain 0.8.1 Reagent project, AFAICT. 即使使用普通的0.8.1试剂项目AFAICT,也会发生这种情况。

I see a Figwheel warning text very briefly, when I first visit the page. 当我第一次访问该页面时,我非常简短地看到了一个Figwheel警告文本。 I'd like to see nothing at all, until the page loads. 在页面加载之前,我一点都不看。 (Or maybe let me put in a custom spinner or something, but one thing at a time.) I'd also like to not have to package and send unnecessary Figwheel code to every client, because it's not big but it should never be needed there. (或者也许让我放入一个自定义的微调器或其他东西,但一次只有一件事。)我也不想打包并向每个客户端发送不必要的Figwheel代码,因为它不大但是永远不需要它那里。

I think you are looking for lein uberjar : 我想你正在寻找lein uberjar

~/expr/cljs-enflame > lein uberjar
Created /home/alan/expr/cljs-enflame/target/cljs-enflame-0.1.0-SNAPSHOT.jar
Created /home/alan/expr/cljs-enflame/target/cljs-enflame-0.1.0-SNAPSHOT-standalone.jar

You can then deploy the standalone version, and kick off your program with a command like: 然后,您可以部署独立版本,并使用以下命令启动程序:

> java -jar target/cljs-enflame-0.1.0-SNAPSHOT-standalone.jar

where you specify the main program entry point in project.clj like: project.clj指定主程序入口点的位置如下:

:main  demo.hello

I think your packaging process will require two steps: 我认为您的包装过程需要两个步骤:

  • First: Compile the ClojureScript code with a production profile. 第一步:使用生产配置文件编译ClojureScript代码。 You probably have something like that available with lein cljsbuild prod once or a similar target. 你可能有lein cljsbuild prod once或类似的目标。 The idea is that you want the production profile to produce that single, optimized JavaScript file that will be served by Tomcat as a static resource. 我们的想法是,您希望生产配置文件生成单个优化的JavaScript文件,该文件将由Tomcat作为静态资源提供。

  • Second: build the WAR file for Tomcat, with lein ring uberwar . 第二:为Tomcat构建WAR文件, lein ring uberwar

Depending on how you serve static files from your web application, the path to the static resources may change, but unless you add any other configuration, you'll be either serving the static resources as explained in this answer: https://stackoverflow.com/a/7820392/483566 根据您从Web应用程序提供静态文件的方式,静态资源的路径可能会发生变化,但除非您添加任何其他配置,否则您将按照以下答案中的说明提供静态资源: https:// stackoverflow。 COM / A /四十八万三千五百六十六分之七百八十二万零三百九十二

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在没有sdk的情况下部署基于窗口的手机应用程序 - How can i deploy an window based phone application without sdk 如何部署Silverlight 4应用程序 - how can I deploy my silverlight 4 application 如何在不将整个组件安装到用户的情况下部署使用ODAC的.NET应用程序? - How can I deploy a .NET application that uses ODAC without installing the whole component to the user? GoogleApps - 如何部署我的应用程序 - GoogleApps - how can I deploy my application 如何在没有.NET v4.0的目标环境上部署.NET v4.0应用程序? - How can I deploy .NET v4.0 application on target environment without .NET v4.0? 如何使用Jenkins将更新部署到OpenShift Mono应用程序? - How can I deploy updates to an OpenShift Mono application with Jenkins? 如何在没有IIS的情况下部署WCF服务? - How can I deploy my WCF Service without IIS? 如何使用 Visual Studio 2015 部署 Durandal 应用程序? - How can I deploy a Durandal application using visual studio 2015? 我如何只使用`Git`部署大型应用程序的一部分? - How can I only deploy portions of a big application using `Git`? 如何在tomcat的godaddy vps中部署spring boot应用程序? - How can i deploy spring boot application in godaddy vps in tomcat?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM