[英]Building React views with Webpack from a Java server
I'm currently developing a front end app with React.js, using Webpack for the build. 我目前正在使用Webpack开发带有React.js的前端应用程序。 For the development process, I'm using Webpack Dev Server, which is fine for my own purposes.
在开发过程中,我使用的是Webpack Dev Server,这对于我自己的目的是很好的。 I have configured production Webpack builds from Node.js servers and am comfortable with how that works.
我已经从Node.js服务器配置了生产Webpack构建,并对它的工作方式很满意。
For this project, however, the server is being written in Java. 但是,对于该项目,服务器是用Java编写的。 How would one go about performing the Webpack build process in this environment?
在这种环境下如何执行Webpack构建过程?
Having forgotten about this question for some time, I just looked at my profile and realized that I do know the answer. 忘记这个问题已有一段时间了,我只是看了一下个人资料,便意识到我确实知道答案。 And the answer is:
答案是:
Webpack is a Node.js process, and would need to be run on a Node.js server. Webpack是一个Node.js进程,需要在Node.js服务器上运行。 Now, you'd actually probably be able to run a concurrent Node process just to build the front-end stuff with Webpack.
现在,您实际上可能能够运行一个并发的Node进程,而只是使用Webpack构建前端的东西。 The other option would be to throw React and your dependencies into whichever directory you're serving your JS scripts from.
另一个选择是将React和您的依赖项放到您要为其提供JS脚本的目录中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.