Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: switch to sirv and disable cache #737

Merged
merged 1 commit into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,13 @@
"@types/node": "^16",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"@types/serve-static": "1.15.7",
"antd": "5.19.1",
"normalize.css": "8.0.1",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-error-boundary": "^4.1.2",
"react-router-dom": "6.4.3",
"serve-static": "1.16.2",
"sirv": "2.0.4",
"typescript": "^5.2.2"
},
"publishConfig": {
Expand Down
3 changes: 2 additions & 1 deletion packages/client/rsbuild.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { pluginTypeCheck } from '@rsbuild/plugin-type-check';
import { pluginNodePolyfill } from '@rsbuild/plugin-node-polyfill';
import type { Rspack, RsbuildConfig } from '@rsbuild/core';
import { pluginSass } from '@rsbuild/plugin-sass';
import serve from 'serve-static';
import serve from 'sirv';
import path from 'path';
import fs from 'fs';

Expand Down Expand Up @@ -196,6 +196,7 @@ export default defineConfig(({ env }) => {
(middlewares) => {
if (fs.existsSync(WebpackRsdoctorDirPath)) {
const fn = serve(WebpackRsdoctorDirPath, {
dev: true,
setHeaders(res) {
res.setHeader('Content-Type', 'text/plain; charset=utf-8');
},
Expand Down
3 changes: 1 addition & 2 deletions packages/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"json-cycle": "^1.5.0",
"lodash": "^4.17.21",
"open": "^8.4.2",
"serve-static": "1.16.2",
"sirv": "2.0.4",
"socket.io": "4.8.1",
"source-map": "^0.7.4",
"tapable": "2.2.1"
Expand All @@ -43,7 +43,6 @@
"@types/cors": "2.8.17",
"@types/lodash": "^4.17.14",
"@types/node": "^16",
"@types/serve-static": "1.15.7",
"tslib": "2.8.1",
"typescript": "^5.2.2"
},
Expand Down
8 changes: 6 additions & 2 deletions packages/sdk/src/sdk/server/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Common, SDK, Thirdparty, Client } from '@rsdoctor/types';
import { Server } from '@rsdoctor/utils/build';
import serve from 'serve-static';
import serve from 'sirv';
import { Bundle } from '@rsdoctor/utils/common';
import assert from 'assert';
import bodyParser from 'body-parser';
Expand Down Expand Up @@ -96,7 +96,11 @@ export class RsdoctorServer implements SDK.RsdoctorServerInstance {
? this._innerClientPath
: require.resolve('@rsdoctor/client');
const clientDistPath = path.resolve(clientHtmlPath, '..');
this.app.use(serve(clientDistPath));
this.app.use(
serve(clientDistPath, {
dev: true,
}),
);

await this._router.setup();

Expand Down
18 changes: 6 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.