Bug report
What is the current behavior?
The target property is not available on the LoaderContext (this) type, despite the documentation stating that it should be there, and my experience with an existing loader that successfully accesses this property at runtime.
If the current behavior is a bug, please provide the steps to reproduce.
Import the LoaderContext type and try to access the target property.
import { type LoaderContext } from 'webpack';
const myLoader = (this: LoaderContext<any>) => {
console.log(this.target); // TypeScript error: Property 'target' does not exist on type 'LoaderContext<any>'
}
What is the expected behavior?
The property should be accessible on the type and there should be no TypeScript error.
Other relevant information:
webpack version: 5.75.0
Node.js version: 16.19.0
Operating System: MacOS 13.1
Additional tools: pnpm
Bug report
What is the current behavior?
The
targetproperty is not available on theLoaderContext(this) type, despite the documentation stating that it should be there, and my experience with an existing loader that successfully accesses this property at runtime.If the current behavior is a bug, please provide the steps to reproduce.
Import the
LoaderContexttype and try to access thetargetproperty.What is the expected behavior?
The property should be accessible on the type and there should be no TypeScript error.
Other relevant information:
webpack version:
5.75.0Node.js version:
16.19.0Operating System: MacOS 13.1
Additional tools:
pnpm