Skip to content

Commit

Permalink
fix: ignore static resource when render server entry
Browse files Browse the repository at this point in the history
  • Loading branch information
ClarkXia committed Aug 22, 2023
1 parent 1ccd3a6 commit c016bd3
Showing 1 changed file with 3 additions and 1 deletion.
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 c016bd3

Please sign in to comment.