Iām trying to create a Meteor/React npm package that includes both server and client. Itās a CRUD module with authorization controls, logging and other goodies.
The server side works, and nearly all the client side but, just when I thought I was done, I hit two horrendous, impenetrable bugs. They both occur while trying instantiate interactive forms made with tcomb-form
.
Ignoring the stuff below the line; my question is simple :
Are there known reasons why Meteor/React client side code cannot be run out of a Node package?
Has anyone else done this successfully? Am I the fool rushing in where angels fear to tread?
The two failures ā¦
Exception from Tracker recompute function:
TypeError: reactiveFn is not a function
at modules.js?hash=38eec26ā¦:30735
at Tracker.Computation._compute (tracker.js?hash=9f8a0ceā¦:339)
at new Tracker.Computation (tracker.js?hash=9f8a0ceā¦:229)
at Object.Tracker.autorun (tracker.js?hash=9f8a0ceā¦:604)
at modules.js?hash=38eec26ā¦:30734
at Object.Tracker.nonreactive (tracker.js?hash=9f8a0ceā¦:631)
at onPropsChange (modules.js?hash=38eec26ā¦:30733)
at Container._subscribe (modules.js?hash=38eec26ā¦:30440)
at new Container (modules.js?hash=38eec26ā¦:30368)
at modules.js?hash=38eec26ā¦:23391
Exception from Tracker recompute function:
meteor.js?hash=e3f53dbā¦:930 Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. Check the render method of `_class`.
at invariant (http://localhost:3000/packages/modules.js?hash=38eec2661c38495d18ae8ce92ab43d7c9049dd5e:11044:15)
at instantiateReactComponent (http://localhost:3000/packages/modules.js?hash=38eec2661c38495d18ae8ce92ab43d7c9049dd5e:23037:134)
at instantiateChild (http://localhost:3000/packages/modules.js?hash=38eec2661c38495d18ae8ce92ab43d7c9049dd5e:22850:28)
at http://localhost:3000/packages/modules.js?hash=38eec2661c38495d18ae8ce92ab43d7c9049dd5e:22877:16
at traverseAllChildrenImpl (http://localhost:3000/packages/modules.js?hash=38eec2661c38495d18ae8ce92ab43d7c9049dd5e:24536:5)
at traverseAllChildren (http://localhost:3000/packages/modules.js?hash=38eec2661c38495d18ae8ce92ab43d7c9049dd5e:24631:10)
at Object.instantiateChildren (http://localhost:3000/packages/modules.js?hash=38eec2661c38495d18ae8ce92ab43d7c9049dd5e:22876:7)
at ReactDOMComponent._reconcilerInstantiateChildren (http://localhost:3000/packages/modules.js?hash=38eec2661c38495d18ae8ce92ab43d7c9049dd5e:22422:41)
at ReactDOMComponent.mountChildren (http://localhost:3000/packages/modules.js?hash=38eec2661c38495d18ae8ce92ab43d7c9049dd5e:22461:27)
at ReactDOMComponent._createInitialChildren (http://localhost:3000/packages/modules.js?hash=38eec2661c38495d18ae8ce92ab43d7c9049dd5e:19705:32)
For the suicidally curious ā
Iām using the Chrome debugger to try to find where the failure occurs, but I get lost in seemingly endless messaging loops and, frankly, canāt be certain Iām not just following error paths caused by time outs introduced by the debugger.
I believe itās failing in composeWithTracker
somewhere, before it ever gets to tcomb-form
.
- the code blows up on this line here, with the
reactiveFn
failure when trying to Update an existing widget, and with theInvariant Violation
when trying to Create a new one. - the Circle Ci build and test (failing of course) is here.
- the package is incorporated with
npm link
in this file. - package dependencies (like logging and authorization) that are initialized later than the package are mocked in utils.js and then replaced by the real ones here.
- the complete original working client side code, from before trying to move it out to an npm package, is here.
The whole project uses the Mantra spec structure and mantra-core
tooling.