Skip to content

[BUG] : 3.0.0-preview.1 : Unable to use mgt-react components in SPFx #2158

@anoopt

Description

@anoopt

Describe the bug
With v3.0.0-preview.1 of mgt-react, when an mgt-react component is used in an SFPx web part, we get an error saying - Script error for: @microsoft/microsoft-graph-client http://requirejs.org/docs/errors.html#scripterror

To Reproduce
Steps to reproduce the behavior:

  1. Create an SFPx web part (with react as the framework)
  2. Add @microsoft/mgt-spfx and @microsoft/mgt-react packages - version 3.0.0-preview.1
  3. Setup the web part with provider and add an mgt-react component as mentioned here skipping the library part.
  4. Run the code
  5. Add the web part on to a page

Code added in the component

import { Person } from '@microsoft/mgt-react';
// import { Person } from '@microsoft/mgt-react/dist/es6/spfx';
// import { Person } from '@microsoft/mgt-react/dist/es6/generated/react';
...
...
// in render
<Person personQuery="me"></Person>

Expected behavior
The mgt-react component should load in the web part.

Screenshots

On web part load:
image

Logs from console:
image

Another type of error that is seen sometimes on web part load:
image

Environment (please complete the following information):

  • OS: Windows 10
  • Browser: Edge
  • Framework: react
  • Context: SharePoint
  • Version: 3.0.0-preview.1
  • Provider: SharePointProvider

Additional context
Tried the same by deploying @microsoft/mgt-spfx SharePoint Framework package to the tenant and still get the same error.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done ✔️

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions