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(type): Add missing OptimizationSplitChunksNameFunction param #8707

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Lemonexe
Copy link

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):

    optimization: {
        splitChunks: {
            chunks: 'all',
            // Rspack type declaration is missing the 2nd argument
            // @ts-expect-error Target signature provides too few arguments. Expected 2 or more, but got 1.
            name: (_module, chunks: Chunk[]) => {
                return chunks.length === 1
                    ? chunks[0].name
                    : `shared/${chunks.map((item: any) => item.name.split('/').pop()).join('~')}`;
            },
        },
    },

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@CLAassistant
Copy link

CLAassistant commented Dec 13, 2024

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added the release: bug fix release: bug related release(mr only) label Dec 13, 2024
Copy link

netlify bot commented Dec 13, 2024

Deploy Preview for rspack canceled.

Built without sensitive environment variables

Name Link
🔨 Latest commit 78daf6d
🔍 Latest deploy log https://app.netlify.com/sites/rspack/deploys/675c661770645700082e3496

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release: bug fix release: bug related release(mr only)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants