node.js - BUILD 后 REACTJS 中的空白页
问题描述
我还在学习所以请放轻松...
我已经进行了部署和构建应用程序。但只是初始页面显示内容......所有其他页面,显示为空白。在控制台中看起来他找到了页面,但没有打开。
此错误出现在控制台中:
Uncaught SyntaxError: Unexpected token '<' 2.283742ca.chunk.js:1
Uncaught SyntaxError: Unexpected token '<' main.9ee80443.chunk.js:1
我真的不知道如何解决。
网站已上线。如果有人可以帮助...给我一些光... http://calces.com.br | http://calces.com.br/admin/usuarios
在这两个例子中。来自 chunk.js 的响应是不同的......
我已尝试将其放在 client/public/.htacess 上,但也不起作用
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.html [L]
</IfModule>
我的 server.js
app.use(express.static(path.join(__dirname, "client/build")));
app.get("*", (req, res) => {
res.sendFile(path.join(__dirname, "client/build", "index.html"));
});
解决方案
推荐阅读
- apache-kafka - 确保每个 Kafka 消费者具有不同/唯一的 group.id 来实现发布-订阅的策略
- javascript - TS2334 属性“长度”在“对象”类型上不存在。仅在应用启动时(ng-serve)
- node.js - 如何在 Loopback 4 身份验证策略中重定向?
- c# - 如何将鼠标单击事件处理程序添加到位图图像构造函数?
- django - Django - 在 ModelForm 的模板中显示用户下拉列表
- r - 预测循环参考方程组
- android-things - Android的东西到olimax板
- c# - OData 聚合列子查询
- javascript - JS - 在 switch-case 中使用函数进行评估
- ember.js - ember js中实用程序和助手之间的区别?