Skip to content

Commit

Permalink
fix: ignore static resource when render server entry (#6484)
Browse files Browse the repository at this point in the history
* fix: ignore static resource when render server entry

* chore: changelog
  • Loading branch information
ClarkXia authored Aug 23, 2023
1 parent 3236acd commit 41bc144
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/quick-turtles-pretend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@ice/app': patch
---

fix: ignore static resource when render server entry
4 changes: 3 additions & 1 deletion packages/ice/src/middlewares/renderMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ export default function createRenderMiddleware(options: Options): Middleware {
const matches = matchRoutes(routes, req.path, basename);
const isStaticResources = /\.(js|mjs|map|json|png|jpg|jpeg|gif|svg|eot|woff2|ttf)$/;
// When documentOnly is true, it means that the app is CSR and it should return the html.
if (matches.length || documentOnly || !isStaticResources) {
if ((matches.length || documentOnly) &&
// Ignore static resources.
!isStaticResources.test(req.path)) {
const serverModule = await excuteServerEntry();
if (serverModule) {
const requestContext: ServerContext = {
Expand Down

0 comments on commit 41bc144

Please sign in to comment.