mobx: "export 'default' (imported as 'mobx') was not found in 'mobx'
Installed version 3.1.14 and I get:
"export 'default' (imported as 'mobx') was not found in 'mobx'
whereas with 3.1.10 everything works fine.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 22 (17 by maintainers)
Mobx is a rather large library that provides many methods that work together, as opposed to being a single function or class with a single purpose. While one could make the case that
observableis really the focus of the library, there isn’t really a single item thatmobxexports that can be called “mobx”. This is the same reason that React doesn’t have a default export, nor does redux.This is precisely the scenario that named exports are for, and maintaining both named and default exports for a library of mobx’s size is cumbersome (as demonstrated by @andykog’s PR above). It also removes the need for deciding “how do I want to import mobx today?”, as there will be only one way to do it. The trade-off cost of
import * as mobx from 'mobx';vsimport mobx from 'mobx';is minimal (4 characters to be precise).