Skip to content

Commit

Permalink
chore: resolve OutputFileSystem type TODO (#4304)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan authored Dec 31, 2024
1 parent 61bde4b commit f0a4162
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions packages/core/src/server/devServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ import {
getTransformedHtml,
loadBundle,
} from './environment';
import {
type RsbuildDevMiddlewareOptions,
getMiddlewares,
} from './getDevMiddlewares';
import { type CompileMiddlewareAPI, getMiddlewares } from './getDevMiddlewares';
import {
type StartServerResult,
getAddressUrls,
Expand Down Expand Up @@ -128,8 +125,7 @@ export async function createDevServer<
https,
};

// TODO: remove this type assertion after Rspack fix the type definition
let outputFileSystem = fs as Rspack.OutputFileSystem;
let outputFileSystem: Rspack.OutputFileSystem = fs;
let lastStats: Rspack.Stats[];

// should register onDevCompileDone hook before startCompile
Expand All @@ -148,9 +144,7 @@ export async function createDevServer<
})
: Promise.resolve();

const startCompile: () => Promise<
RsbuildDevMiddlewareOptions['compileMiddlewareAPI']
> = async () => {
const startCompile: () => Promise<CompileMiddlewareAPI> = async () => {
const compiler = customCompiler || (await createCompiler());

if (!compiler) {
Expand All @@ -172,11 +166,10 @@ export async function createDevServer<

await compilerDevMiddleware.init();

// TODO: remove this type assertion after Rspack fix the type definition
outputFileSystem =
(isMultiCompiler(compiler)
? compiler.compilers[0].outputFileSystem
: compiler.outputFileSystem) || (fs as Rspack.OutputFileSystem);
: compiler.outputFileSystem) || fs;

return {
middleware: compilerDevMiddleware.middleware,
Expand Down

1 comment on commit f0a4162

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Ran ecosystem CI: Open

suite result
modernjs ❌ failure
plugins ❌ failure
rspress ✅ success
rslib ❌ failure
examples ❌ failure

Please sign in to comment.