adding mobx to spfx React web part breaks build
Category
- [ ] Question
- [ ] Typo
- [x ] Bug
- [ ] Additional article idea
After scaffolding a new spfx web part with react and adding mobx integrations, bundle fails with errors thrown from files in node_modules.
Expected or Desired Behavior
gulp bundle should succeed after adding reference to observable in code
Observed Behavior
gulp bundle exits in failure. Exact text can be found here:
Steps to Reproduce
Two ways:
- clone this repo and run
npm installandgulp serve --nobrowser
or
-
- scaffold a new spfx web part using react
npm install mobx mobx-react- add
import {observable} from 'mobx';to any typescript file gulp serveorgulp bundle
generator version is 1.7.1 node version is 8.12.0
I'm sure it has to be some sort of dependency collision but wasn't able to figure it out after a few hours of head scratching.
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
I was able to get this working with the help of a colleague. Later versions of mobx do not seem to play well with spfx.
Here's the fix:
npm install --save-dev [email protected] [email protected]
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