Cannot add webpart built with Framework version 1.8
Category
- [ ] Question
- [ ] Typo
- [x] Bug
- [ ] Additional article idea
Expected or Desired Behavior
Observed Behavior
I have just upgraded to framework version 1.8 and I've built and deployed the solution. When I try to add the webpart to the page, I get this error
Original error: Error loading https://component-id.invalid/f2f8e00f-ef2a-4909-b24a-818262f88a19_0.0.1
D.createContext is not a function
Built with React 16.7.0 and React-dom 16.7.0
Would appreciate any quick response or help 🙏
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
Where are you trying to deploy this?
@patmill thanks for looking at this. I meant I uploaded the ppkg file to app catalog and deployed it. We host the customizer and webpart js files on Amazon's cdn. This is the same way we've been using the webpart with framework 1.4.1 but because we are using loadTheme and it has recently been causing issues, we have to upgrade urgently.
Sorry - I meant what the target version of SharePoint. Are you deploying to on-prem, or to O365?
@patmill it's SharePoint online on office 365
OK, someone trying to upgrade an existing project ran into this today as well. The problem was a mix of missing package.json entries, pointers to the wrong pnp/* projects, and code that was referencing OUIFR w/o importing it into package.json. We got it sorted out, so we should be able to do the same thing here.
Can you paste your package.json here, and search through your source code in /src for references to office-ui-fabric-react ?
@patmill thanks, here's the content of package.json
{
"name": "shortpoint-spfx",
"version": "0.0.1",
"private": true,
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"build": "gulp bundle",
"clean": "gulp clean",
"test": "gulp test"
},
"dependencies": {
"@microsoft/decorators": "~1.8.0",
"@microsoft/sp-application-base": "~1.8.0",
"@microsoft/sp-core-library": "~1.8.0",
"@microsoft/sp-dialog": "~1.8.0",
"@microsoft/sp-lodash-subset": "~1.8.0",
"@microsoft/sp-office-ui-fabric-core": "~1.8.0",
"@microsoft/sp-webpart-base": "^1.8.0",
"@types/knockout": "3.4.39",
"@types/react": "^16.8.8",
"@types/react-addons-shallow-compare": "~0.14.22",
"@types/react-addons-test-utils": "~0.14.24",
"@types/react-addons-update": "~0.14.20",
"@types/react-dom": "^16.8.2",
"@types/webpack-env": ">=1.12.1 <1.14.0",
"knockout": "3.4.0",
"react": "16.7.0",
"react-dom": "16.7.0"
},
"devDependencies": {
"@microsoft/sp-build-web": "~1.8.0",
"@microsoft/sp-module-interfaces": "~1.8.0",
"@microsoft/sp-webpart-workbench": "~1.8.0",
"@types/chai": ">=3.4.34 <3.6.0",
"@types/mocha": ">=2.2.33 <2.6.0",
"ajv": "~5.2.2",
"gulp": "^3.9.1",
"uglifyjs-webpack-plugin": "^1.2.5",
"@microsoft/sp-tslint-rules": "1.8.0",
"@microsoft/rush-stack-compiler-3.2": "0.2.6"
}
}
Any update on this?
One thing that looks a bit suspicious is the react typings point at 16..8.8. Can you try them at 16.7.22 ? I wonder if you are trying to call a method that doesn't exist on the underlying object, since it is loading react 16.7
@patmill thanks. I couldn't reproduce this issue after changing the versions for react typings
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