Skip to content

Commit

Permalink
fix: faviconPlugin should after staticPlugin & update integration test (
Browse files Browse the repository at this point in the history
  • Loading branch information
GiveMe-A-Name authored Jul 30, 2024
1 parent f19b9dc commit 604ad3a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .changeset/tender-trees-move.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@modern-js/prod-server': patch
'@modern-js/server-core': patch
---

fix: faviconPlugin should after staticPlugin
fix: faviconPlugin 应该在 staticPlugin 之后
2 changes: 0 additions & 2 deletions packages/server/core/src/plugins/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
} from './monitors';
import { processedByPlugin } from './processedBy';
import { logPlugin } from './log';
import { faviconPlugin } from './favicon';

export type CreateDefaultPluginsOptions = InjectRenderHandlerOptions & {
logger?: Logger;
Expand All @@ -27,7 +26,6 @@ export function createDefaultPlugins(
injectServerTiming(),
logPlugin(),
processedByPlugin(),
faviconPlugin(),
];

return plugins;
Expand Down
2 changes: 2 additions & 0 deletions packages/server/prod-server/src/apply.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
renderPlugin,
NodeServer,
createDefaultPlugins,
faviconPlugin,
} from '@modern-js/server-core';
import {
serverStaticPlugin,
Expand Down Expand Up @@ -58,6 +59,7 @@ export async function applyPlugins(
...(options.plugins || []),
injectResourcePlugin(),
serverStaticPlugin(),
faviconPlugin(),
renderPlugin(),
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Link, useLoaderData } from '@modern-js/runtime/router';
export default () => {
const data = useLoaderData() as string;
return (
<div>
<div className="page-a">
{data}
<Link to="/b">jupmp to B</Link>
</div>
Expand Down
6 changes: 6 additions & 0 deletions tests/integration/ssr/tests/partial.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ describe('test partial ssr', () => {

await page.goto(`http://localhost:${appPort}/one/a`);
await page.waitForSelector('#root_layout');
await page.waitForSelector('.page-a');
const pageContent = await page.content();
expect(pageContent).toContain('root layout');
expect(pageContent).toContain('PageA Data');
Expand All @@ -66,6 +67,8 @@ describe('test partial ssr', () => {

await page.goto(`http://localhost:${appPort}/one/b`);
await page.waitForSelector('#root_layout');
await page.waitForSelector('.page-b');

const pageContent = await page.content();
expect(pageContent).toContain('root layout');
expect(pageContent).toContain('PageB Data');
Expand All @@ -89,8 +92,11 @@ describe('test partial ssr', () => {

await page.goto(`http://localhost:${appPort}/one/b/d`);
await page.waitForSelector('#root_layout');
await page.waitForSelector('.page-d');

const pageContent = await page.content();
expect(pageContent).toContain('root layout');

expect(pageContent).toContain('PageD Data');
});
});

0 comments on commit 604ad3a

Please sign in to comment.