sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

oob React SPFx web part broken from yo due to Fabric 7 references

Open SPDoctor opened this issue 7 years ago • 12 comments

Category

  • [ ] Question
  • [ ] Typo
  • [x] Bug
  • [ ] Additional article idea

Expected or Desired Behavior

yo @microsoft/sharepoint generates a React web part which runs without errors

Observed Behavior

yo @microsoft/sharepoint generates a React web part which runs but produces voluminous source file resolution error messages

Steps to Reproduce

yo @microsoft/sharepoint (choose framework React web part, name HelloWorld, all other options are default.) npm install gulp serve or gulp bundle

Terminal window emits dozens of errors like the following:


 @ ./node_modules/@uifabric/foundation/node_modules/@uifabric/utilities/lib/index.js 44:0-44
 @ ./node_modules/@uifabric/foundation/lib/index.js
 @ ./node_modules/office-ui-fabric-react/lib/Foundation.js
 @ ./node_modules/office-ui-fabric-react/lib/components/Stack/Stack.js
 @ ./node_modules/office-ui-fabric-react/lib/components/Stack/index.js
 @ ./node_modules/office-ui-fabric-react/lib/Stack.js
 @ ./node_modules/office-ui-fabric-react/lib/index.js
 @ ./lib/webparts/helloWorld/components/HelloWorld.js
 @ ./lib/webparts/helloWorld/HelloWorldWebPart.js
./node_modules/@uifabric/foundation/node_modules/@uifabric/utilities/lib/safeSetTimeout.js
(Emitted value instead of an instance of Error) Cannot find source file '../src/safeSetTimeout.ts': Error: Can't resolve '../src/safeSetTimeout.ts' in 'C:\Users\BillA\Documents\Projects\OfficeDev\HelloWorld\node_modules\@uifabric\foundation\node_modules\@uifabric\utilities\lib'
NonErrorEmittedError: (Emitted value instead of an instance of Error) Cannot find source file '../src/safeSetTimeout.ts': Error: Can't resolve '../src/safeSetTimeout.ts' in 'C:\Users\BillA\Documents\Projects\OfficeDev\HelloWorld\node_modules\@uifabric\foundation\node_modules\@uifabric\utilities\lib'
    at emitWarning (C:\Users\BillA\Documents\Projects\OfficeDev\HelloWorld\node_modules\webpack\lib\NormalModule.js:117:16)
    at C:\Users\BillA\Documents\Projects\OfficeDev\HelloWorld\node_modules\source-map-loader\index.js:80:7
    at onError (C:\Users\BillA\Documents\Projects\OfficeDev\HelloWorld\node_modules\enhanced-resolve\lib\Resolver.js:65:10)
    at loggingCallbackWrapper (C:\Users\BillA\Documents\Projects\OfficeDev\HelloWorld\node_modules\enhanced-resolve\lib\createInnerCallback.js:31:19)
    at runAfter (C:\Users\BillA\Documents\Projects\OfficeDev\HelloWorld\node_modules\enhanced-resolve\lib\Resolver.js:158:4)
    at innerCallback (C:\Users\BillA\Documents\Projects\OfficeDev\HelloWorld\node_modules\enhanced-resolve\lib\Resolver.js:146:3)
    at loggingCallbackWrapper (C:\Users\BillA\Documents\Projects\OfficeDev\HelloWorld\node_modules\enhanced-resolve\lib\createInnerCallback.js:31:19)
    at next (C:\Users\BillA\Documents\Projects\OfficeDev\HelloWorld\node_modules\tapable\lib\Tapable.js:252:11)
    at C:\Users\BillA\Documents\Projects\OfficeDev\HelloWorld\node_modules\enhanced-resolve\lib\UnsafeCachePlugin.js:40:4
    at loggingCallbackWrapper (C:\Users\BillA\Documents\Projects\OfficeDev\HelloWorld\node_modules\enhanced-resolve\lib\createInnerCallback.js:31:19)


Web part runs normally - error messages presumably coming from webpack. I would categorise this as non-critical because the component does run.

SPDoctor avatar Jun 14 '19 11:06 SPDoctor

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

msft-github-bot avatar Jun 14 '19 11:06 msft-github-bot

We've seen similar things since last night when Office UI Fabric was updated to version 7. If you take a look at the package-lock.json file there's references to v 7, and new versions of React, even though you're just using OUIF 6. This seems to be an issue with the @uifabric/foundation that just did a minor update but still has dependencies on v 7 and the new React

wictorwilen avatar Jun 14 '19 11:06 wictorwilen

Yes, pretty sure it's OUIF-related. But seeing React 16.7 which is normal for SPFx 1.82. I also have a version using React 16.8 which has same errors. I couldn't see a v7 reference but sounds like a good theory ;-)

SPDoctor avatar Jun 14 '19 11:06 SPDoctor

Okay, see it now in @uifabric/foundation dependencies.

SPDoctor avatar Jun 14 '19 11:06 SPDoctor

Thanks for sharing - we are now tracking this internally. Sorry for the inconvenience.

VesaJuvonen avatar Jun 14 '19 11:06 VesaJuvonen

@JasonGore @JDHuntington.

dzearing avatar Jun 14 '19 14:06 dzearing

Status - Issue has been identified and fix is being planned.

VesaJuvonen avatar Jun 14 '19 15:06 VesaJuvonen

This is now resolved for 6. (Temporarily we are busted for 7, but it will be patched after.)

Here’s what happened:

We’ve thoroughly tested new releases of both 6 and 7 that they work and install correctly. Not the issue.

The yeoman template refers to an older build of 6 (6.154.0 I think) which had this range dependency:

@uifabric/foundation: >= 0.7.1 <1.0.0

We later discovered that range dependencies are bad for pre-releases, and switched them to use carets. Carets for prerelease packages do not bump the minor, but act as a tilde does for >0 majors. We had fixed this in OUFR a while ago, in around ~6.180.

When we released Fabric 7, we minor bumped the foundation pre-release, not realizing the range dependency was still out in the wild. This passed all of our tests, but we didn’t try to go back to every pre-release to understand npm’s behavior in this situation.

I’ve addressed by unpublishing the foundation minor releases. I tested yo @microsoft/sharepoint before and after the change. It now correctly installs fabric 6 bits.

For the fabric 7 bits, we will republish foundation as a major release, which will make this situation impossible to hit going forward.

Sorry for the disruption!

dzearing avatar Jun 14 '19 15:06 dzearing

As issue has been resolved, closing this one as fixed. Thanks everyone for your participation on getting this issue resolved.

VesaJuvonen avatar Jun 14 '19 15:06 VesaJuvonen

@dzearing - love this kind of direct information on what went wrong!

wictorwilen avatar Jun 16 '19 11:06 wictorwilen

We are facing a similar issue again. This time it seems it is the @uifabric/utilities dependency for @types/react-dom. We saw that a new version has been published for the package, which now expects a version for @types/react-dom to lie between >=16.3.0 <17.0.0. It was earlier installing version 16.0.5 for the @types/react-dom and we now get an error saying it requires there are invalid peer dependencies. Attaching the error screen. error

ishanisuchak avatar Jul 25 '19 10:07 ishanisuchak

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues

msft-github-bot avatar Jan 24 '20 06:01 msft-github-bot