On developing the SharePoint Framework web part, we may receive the below error message SPFxon loading the web part in the page.

[SPLoaderError.loadComponentError]:

***Failed to load component “2a602d35-fbae-40d3-80f3-4a2afa1e514b” (HelloWorldWebPart).
Original error: ***Failed to load entry point from component “2a602d35-fbae-40d3-80f3-4a2afa1e514b” (HelloWorldWebPart).
Original error: Error loading https://component-id.invalid/2a602d35-fbae-40d3-80f3-4a2afa1e514b_0.0.1
Cannot find module “@ms/sp-telemetry”

***INNERERROR:
***Failed to load entry point from component “2a602d35-fbae-40d3-80f3-4a2afa1e514b” (HelloWorldWebPart).
Original error: Error loading https://component-id.invalid/2a602d35-fbae-40d3-80f3-4a2afa1e514b_0.0.1
Cannot find module “@ms/sp-telemetry”
***CALLSTACK:
Error
at SPError (https://localhost:4321/node_modules/@microsoft/sp-loader/dist/sp-loader-assembly_en-us.js:10183:9)
at SPLoaderError (https://localhost:4321/node_modules/@microsoft/sp-loader/dist/sp-loader-assembly_en-us.js:4211:9)
at ErrorBuilder.buildErrorWithVerboseLog (https://localhost:4321/node_modules/@microsoft/sp-loader/dist/sp-loader-assembly_en-us.js:3821:9)
at ErrorBuilder.buildLoadComponentError (https://localhost:4321/node_modules/@microsoft/sp-loader/dist/sp-loader-assembly_en-us.js:3743:9)
at Anonymous function (https://localhost:4321/node_modules/@microsoft/sp-loader/dist/sp-loader-assembly_en-us.js:7952:9)

Root Cause:
The above issue may raise due to the incorrect reference in the code. For me I have tried to call the webpartcontext code and I have use the below references in the code.


import IWebPartContext from '@microsoft/sp-webpart-base/lib/core/IWebPartContext';
import SPHttpClient from '@microsoft/sp-http/lib/spHttpClient/SPHttpClient';

Solution:
To resolve the issue, I have added the below references by replacing the above code


import { IWebPartContext } from '@microsoft/sp-webpart-base';
import { SPHttpClient } from '@microsoft/sp-http';

Failed to load component in SharePoint Framework
Tagged on:     

One thought on “Failed to load component in SharePoint Framework

  • July 19, 2018 at 10:24 PM
    Permalink

    Thanks Shantha . It resolved my issue.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *