-
-
Notifications
You must be signed in to change notification settings - Fork 593
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(type): Add missing OptimizationSplitChunksNameFunction param #8707
base: main
Are you sure you want to change the base?
fix(type): Add missing OptimizationSplitChunksNameFunction param #8707
Conversation
✅ Deploy Preview for rspack canceled.Built without sensitive environment variables
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution! Can you update the related files too?
- Zod schema:
rspack/packages/rspack/src/config/zod.ts
Line 1176 in 75f0d20
// FIXME: z.array(z.instanceof(Chunk)).optional(), z.string() - Run
pnpm run api-extractor:local
to updateapi.md
packages/rspack/src/config/types.ts
Outdated
export type OptimizationSplitChunksNameFunction = ( | ||
module?: Module, | ||
chunks?: Chunk[] | ||
) => unknown; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why the module
parameter was optional in the previous definition. We can also add the missing cacheGroupKey
parameter.
export type OptimizationSplitChunksNameFunction = ( | |
module?: Module, | |
chunks?: Chunk[] | |
) => unknown; | |
export type OptimizationSplitChunksNameFunction = ( | |
module: Module, | |
chunks: Chunk[], | |
cacheGroupKey: string | |
) => string | undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done as suggested 🙂
As @chenjiahan pointed out, I also updated the zod schema, which I hadn't known about.
I ran npm run api-extractor:local
, but that produced a lot of diffs, idk if that seems right.
78daf6d
to
cc847d7
Compare
Summary
Add missing argument to type declaration of
OptimizationSplitChunksNameFunction
.Notes
ℹ️ I have found this only empirically while migrating a webpack project to Rspack, but I have no experience with Rspack codebase, so it'd be appreciated if reviewers verified if the type declaration is appropriate.
The following excerpt of
rspack.config.ts
works correctly, but yields TS error (it is used to group shared chunks, e.g.shared/main-app~subprocess-app.js
):Checklist
updated(or not required).updated(or not required).