Skip to main content
The error “Property ‘context’ does not exist on type ‘Require’” typically occurs in TypeScript projects that use Webpack’s require.context. This happens because TypeScript does not recognize the context property on the Require type by default.

Resolution

Install the Webpack type definitions for your project:
npm i -D @types/webpack-env
This installs the @types/webpack-env package as a dev dependency, which provides the TypeScript type definitions for Webpack-specific require extensions including require.context.

Build docs developers (and LLMs) love