英文:
why react application is not loading js bundle in appengine server
问题
在本地和AWS上运行良好的React应用,在使用以下命令部署到Google App Engine时,会打开一个包含index.html内容的白色新网站;在页面源代码中如下所示:
<!doctype html>
<html class="no-js" lang="en" dir="ltr">
<head>
<base href="/" />
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="google" value="notranslate">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<link rel="shortcut icon" href="favicon.ico" />
<link rel="manifest" href="manifest.webapp" />
<link rel="stylesheet" href="static/css/loading.css">
</head>
<body>
<div id="root"/>
</body>
</html>
但不会加载js捆绑包。我在浏览器和服务器日志中找不到任何线索。
英文:
React app which works great in local and aws. But in Google App Engine, when deployed using
mvn appengine:deploy
opens white fresh website which contains the index.html content inside; in the page source like:
<!doctype html>
<html class="no-js" lang="en" dir="ltr">
<head>
<base href="/" />
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="google" value="notranslate">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<link rel="shortcut icon" href="favicon.ico" />
<link rel="manifest" href="manifest.webapp" />
<link rel="stylesheet" href="static/css/loading.css">
</head>
<body>
<div id="root"/>
</body>
</html>
And does not load the js bundle. I couldnt see any clue in the browser and server logs.
答案1
得分: 0
我想你想要托管使用Maven构建的React.js前端和Java后端项目。但是,在Google Cloud Platform中将使用NPM构建的React.js项目和使用Maven构建的Java后端项目合并为一个可部署的包可能会比较困难。
因此,作为一种替代方法,您可以使用Google云平台中的App Engine项目内的微服务。您可以按照此教程来解决您的问题。
如果您只有一个React.js项目,那么在这里有一个教程,教您如何将React应用部署到Google Cloud App Engine。
英文:
I imagine that you want to host the React.js front-end and Java back end project that is build by maven. But It’s difficult to merge a React.js project built with NPM and a Java back-end project built with Maven into one deploy-able package in Google Cloud Patform.
So As an altenative, you can use Google microservices within an App engine project. You can follow this tutorial to solve your issue.
If you have only a Reactjs project so here is a tutorial, how to deploy React App to Google Cloud App Engine.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论