问题标签 [razzle]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
660 浏览

reactjs - Google App Engine - Razzle isomorphic react app - serve issues with no client bundles or assets

I haven't been able to take the default bare-skin razzle-app (https://github.com/jaredpalmer/razzle) and make it work when I deploy it to Google App Engine. If anyone has experience deploying isomorphic react apps to GAE, then any inputs would be great.

After deployment, it serves the html from the server.js (it only serves the html text for the route but nothing else - no application nor any assets on the page). As a proof of concept, I was returning different html content for different routes, and it apparently works as the html text content as well as head tags were different. However, there are no static assets on the site (no images, css or js).

Build process output:

the build directory contains:

Notice that the build/static/js doesn't exist. It's inside build/public/static/js. Is it weird? On accessing the site (only html text from the server), I checked the head if the client bundle waas sent or not. Itis fetching from a wrong location.

My package.json looks like :

Note that GAE runs npm run start.

I'm currently using flex , standard never worked for me at all. app.yaml looks like:

Running locally :

I can access it at localhost:3000, not localhost:3001.

0 投票
1 回答
1655 浏览

javascript - 部署时 Razzle 反应未加载正确的包

我使用yarn create-razzle-app my-app. 构建后,我已将其部署到 nodeJS Elastic Beanstalk 环境中。

在点击弹性 beanstalk url 后,我看到网站没有应用任何 CSS。在本地运行相同的服务器似乎工作正常,所以我想知道是否需要做更多的工作来为弹性豆茎上的 SSR 配置 Razzle 应用程序?

检查bundle.[HASH].jsandbundle.[HASH].css时,它们都如下所示:

这显然会导致错误,因为它不是控制台输出所指示的有效 CSS 或 JSbundle.f03ddc0c.js:1 Uncaught SyntaxError: Unexpected token '<'

index

构建时和在 Elastic Beanstalk 配置上的环境变量是:

package.json

.ebextensions/nodecommand.config

0 投票
1 回答
406 浏览

reactjs - Razzle、IE11 和 HappiJS 捆绑

我有一个使用 Razzle 的服务器端渲染反应应用程序。我正在导入@hapi/joi,因为这是我想要用于服务器和客户端验证的内容。IE11 和 Edge 18 是我的应用程序支持的浏览器,我必须能够在它们上运行我的应用程序(客户端)。

@hapi/joi v16 默认情况下未编译(作为 ES6 发布),这让我认为由于 Edge 18 和 IE11 所需的支持,我必须在我的项目中手动编译依赖项。

我正在尝试使用此配置来做到这一点:

TypeError: Cannot assign to read only property 'exports' of object但是,当我尝试运行我的项目时,我似乎得到了一个。我知道错误与 import 和 module.exports 相关,但自从我 require在我的应用程序中加入 Joi 以来,我并没有完全看出我在哪里出错了。

我在这里做错了什么?

PS:如果您想查看并且配置不够上下文 https://github.com/AntonioValerievVasilev/razzle--hapi ,请将其推送到任何有兴趣的人的回购

0 投票
1 回答
14108 浏览

reactjs - ChunkLoadError:加载块 XY 失败。- 在生产中随机致命

我们的电子商务平台已经投入生产,但我们遇到了奇怪的 ChunkLoadError。此错误随机发生,不可复制。当我们试图打开失败的文件时,它就在那里并且可以正常加载。

如果用户得到这个错误,他会得到白屏(逻辑上),但刷新后一切都很好。

我们正在 React(最新)、Express(最新)上运行 SSR 电子商务

我们的 webpack / razzle 配置

多个错误

这是随机挑选的痕迹

0 投票
2 回答
878 浏览

javascript - 如何在 img 标签中使用 key 属性?

我有这段代码来制作要在屏幕上显示的图像数组。但是,我不知道 images 数组中的 key 属性是什么意思。理想情况下,只要单击其中一张图像,我就想更改图像的 src。如果我在图像中添加idorclassName属性,并使用它进行查找,document.getElementById我会收到以下警告:Warning: Prop `%s` did not match. Server: %s Client: %s%s当我呈现页面时。我正在为这个项目使用 react 和 razzle。有人能告诉我如何做到这一点吗?

0 投票
1 回答
594 浏览

webpack - 如何配置 Razzle.js 以提供来自多个 CDN 的应用程序资产?

浏览器通常会限制来自给定子域的最大并行负载量。因此,我想将资产加载分散到 4 个 CDN 上:

使用类似这样的东西(基于文件名)来确定 CDN 号:

我怎样才能在 Razzle 中做到这一点?

到目前为止,这就是我所拥有的。在razzle.config.js

0 投票
0 回答
153 浏览

node.js - How to migrate react application on server side

I am currently having a client side react application, which is using redux and saga patterns but does not have security implemented. Also there is a server side nodejs application, which has security implemented.

So i want my application to migrate and merge at server side so that it can take advantage of the security implementation and server side rendering.

There are various frameworks available such as Razzle, NextJS etc. but not sure which one should I choose for migrating to server side. Or should I migrate without making use of any framework.

What should be the best approach?

0 投票
0 回答
39 浏览

razzle - 如何从 Razzle 中的 Web 模块中排除服务器模块

有一个库仅在应用程序在服务器上运行时使用。

该模块datadog-node-utils应该捆绑在服务器上,而不是在静态供应商中。

在我的 razzle 配置中,我试图排除这个库。

但没有运气。

该库始终存在于捆绑包中:(

0 投票
1 回答
152 浏览

javascript - 如何在 razzle express 服务器文件中使用@sentry/node

根据哨兵的文档,节点的设置只是

但是,当我跑步时,razzle start我得到了这个

通用应用程序的哨兵回购中有一个已关闭的问题,但没有提供解决方案。

0 投票
1 回答
161 浏览

reactjs - 用 razzle 获取错误输出

我正在为我的 react js 应用程序使用 razzle。当我运行 razzle start --verbose 我得到

✖ 客户端在 4.88s 内编译有一些错误

✖ 服务器在 1.46s 内编译有一些错误

但是我不知道错误是什么。我试图找到一种方法来揭示错误,但没有运气。

有谁知道如何配置才能真正获得错误输出?