Skip to content

Conversation

@remcohaszing
Copy link
Contributor

What?

Define types for require.context.

Why?

This API is available for both Webpack and Turbopack users. Even for Webpack users, Next.js just doesn’t use the webpack package nor the types it provides.

How?

The types are an exact copy of the types provided by webpack, so there’s no conflict if a user does have its types available.

This API is available for both Webpack and Turbopack users. Even for
Webpack users, Next.js just doesn’t use the webpack package nor the
types it provides. The types are an exact copy of the types provided by
webpack, so there’s no conflict if a user does have its types available.
@ijjk
Copy link
Member

ijjk commented Nov 12, 2025

Allow CI Workflow Run

  • approve CI run for commit: ee9784f

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

Copy link

@hugotiger hugotiger left a comment

Choose a reason for hiding this comment

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

Nice fix! I noticed the mode option isn’t supported in Turbopack at the moment — do you think that’s something we should consider in this context?

I might be misunderstanding, but it seems like this also adds these types for fully Turbopack-powered setups 🤔

@remcohaszing
Copy link
Contributor Author

I noticed this too. Initially wrote the types myself, but it turned out those types conflicted with Webpack. Also users may use Webpack themselves, in which case mode is supported. So I think having it as an optional argument makes sense.

@hugotiger
Copy link

Ahhh yes that makes sense! Hopefully there's a possibility to type the different environments separately in the future 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants