SharePoint / SharePoint/sp-dev-docs
Class constructor h cannot be invoked without 'new'
@Ashlesha-MSFT is already working on this.
Since Apr 28, 2026.
- Dominant language
- PowerShell
- Stars
- 1.4k
- Forks
- 1.1k
- Avg merge
- 4d 12h
- Merged PRs (30d)
- 12
Description
Target SharePoint environment
SharePoint Online
What SharePoint development model, framework, SDK or API is this about?
💥 SharePoint Framework
Developer environment
None
What browser(s) / client(s) have you tested
- 💥 Internet Explorer
- 💥 Microsoft Edge
- 💥 Google Chrome
- 💥 FireFox
- 💥 Safari
- mobile (iOS/iPadOS)
- mobile (Android)
- not applicable
- other (enter in the "Additional environment details" area below)
Additional environment details
- SPFx version: 1.20.2
- Node.js version: 18.19.1
Describe the bug / error
We are seeing a tenant-specific regression affecting an SPFx library compiled with TypeScript target es5.
The bug presents with the following console error:
TypeError: Class constructor h cannot be invoked without 'new'
And causes the components that use custom extended versions of SPFx HTTP clients fail when they indirectly use MSGraphClientFactory or SPHttpClient.
For example we are implementing a custom class extending SPHttpClient like this:
export class SPHttpClientWithAuth extends SPHttpClient {
constructor(serviceScope) {
super(serviceScope);
}
}
This is compiled as es5 and has been integrating fine with the SPHttpClient runtime code as that was also es5.
Now that the runtime is es6, this class extend is failing.
Recompiling the library with target: es2015 resolves the issue.
We cannot find Microsoft documentation stating that ES5-compiled SPFx components are no longer supported, nor a published 2026 cutoff date for ES5 in SPFx.
Microsoft documentation still presents MSGraphClientV3 and SPHttpClient as supported SPFx APIs.
Steps to reproduce
-
Configure an SPFx webpart with
"target": "es5"in the tsconfig.json -
In the web part src directory, create a class which extends SPHttpClient
export class CustomSPHttpClient extends SPHttpClient { public static serviceKey = ServiceKey.create<SPHttpClient>("CustomSPHttpClientService", this); constructor(serviceScope: ServiceScope){ super(serviceScope); } protected async _fetch(url: string, configuration: SPHttpClientConfiguration, options: ISPHttpClientOptions): Promise<SPHttpClientResponse> { console.log("Fetch: ", url); return await super._fetch(url, configuration, options); } } -
Consume the CustomSPHttpClient service from the webpart.
-
Deploy the web part on a tenant which uses es6 runtime
-
Observe the error:
TypeError: Class constructor h cannot be invoked without 'new'
Expected behavior
Please confirm whether Microsoft has recently changed the SharePoint Online/SPFx runtime, @microsoft/sp-http, MSGraphClientFactory, SPHttpClient, or related Graph client dependencies to require ES2015+ output. If this is intentional, please provide the official support/deprecation statement. If not, please treat this as a tenant-specific regression.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.