从Spring看本教程,有一个“ frontend-maven-plugin”,您可能会发现它非常有用。我会放弃战争,只是将您的spring
boot应用程序构建为jar,然后将js文件放在src / main / js中,将index.html放在/ src / main / resources
/ static中。
该教程位于:
https://spring.io/guides/tutorials/react-and-spring-data-
rest/
代码在这里可用:
https://github.com/spring-guides/tut-react-and-spring-data-
rest/tree/master/basic
使用与本教程中使用的配置类似的webpack.config.js配置,一旦使用maven前端插件进行构建,它将“正常工作”。
正如其他人所建议的那样,最好将前端代码和后端代码分开(将它们保存在单独的存储库中)。



