Here's a quick stack trace
Uncaught TypeError: Cannot set property 'default' of undefined
at Object.<anonymous> (mobx.js:50)
at Object../node_modules/mobx/lib/es2015/mobx.js (mobx.js:2830)
at __webpack_require__ (bootstrap c57644c…:691)
at fn (bootstrap c57644c…:110)
at Object.7 (vendors.bundle.c57644c….js:55622)
at __webpack_require__ (bootstrap c57644c…:691)
at ./node_modules/add-px-to-style/index.js.IS_UNITLESS.animationIterationCount (bootstrap c57644c…:786)
at bootstrap c57644c…:786
The line with issue appears to be the very last line in this code block.
Is this related to #858 ?
registerGlobals();
export { Atom, BaseAtom };
export { Reaction };
export { untracked, IDerivationState };
export { useStrict, isStrictModeEnabled };
export { spy };
export { asReference, asFlat, asStructure, asMap };
export { isModifierDescriptor };
export { isObservableObject };
export { isObservableValue as isBoxedObservable };
export { isObservableArray };
export { ObservableMap, isObservableMap, map };
export { transaction };
export { observable, IObservableFactories };
export { computed };
export { isObservable };
export { isComputed };
export { extendObservable, extendShallowObservable };
export { observe };
export { intercept };
export { autorun, autorunAsync, when, reaction };
export { action, isAction, runInAction };
export { expr };
export { toJS };
export { createTransformer };
export { whyRun };
export { isArrayLike };
export const extras = {
allowStateChanges,
deepEqual,
getAtom,
getDebugName,
getDependencyTree,
getAdministration,
getGlobalState,
getObserverTree,
isComputingDerivation,
isSpyEnabled,
onReactionError,
resetGlobalState,
shareGlobalState,
spyReport,
spyReportEnd,
spyReportStart,
setReactionScheduler
};
if (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === "object") {
__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx(module.exports);
}
module.exports.default = module.exports;
[x ] Did you check this issue wasn't filed before?
[x ] Elaborate on your issue. What behavior did you expect?
I expected my build not to break
[x ] State the versions of MobX and relevant libraries. Which browser / node / ... version?
webpack: 2.2.1
mobx 3.1.6
mobx-react 4.1.6
I'm fairly certain nothing else is the issue because if i downgrade mobx to the last known good combo i had:
mobx 3.1.2
mobx-react 4.1.1
Build works as expected again.
Could you try [email protected] ?
Same issue here!
But works fine with [email protected] and downwards, maybe module var is overwritten in 3.1.6?
Probably webpack 2 prefers the es2015 build, but for es6 modules doesn't provide the module.exports stuff which is used only to simulate
@mweststrate some progress. different error now.
Uncaught TypeError: Cannot set property 'struct' of undefined
at Object.<anonymous> (mobx.js:516)
at Object.<anonymous> (mobx.js:2832)
at __webpack_require__ (bootstrap 048f392…:52)
at Object.<anonymous> (harmony-module.js:24)
at __webpack_require__ (bootstrap 048f392…:52)
at bootstrap 048f392…:144
at bootstrap 048f392…:144
happens here:
observable.deep.struct = observable.struct;
in this block of code:
var observable = createObservable;
Object.keys(IObservableFactories.prototype).forEach(key => observable[key] = IObservableFactories.prototype[key]);
observable.deep.struct = observable.struct;
observable.ref.struct = function () {
if (arguments.length < 2) {
return createModifierDescriptor(refStructEnhancer, arguments[0]);
}
else {
return refStructDecorator.apply(null, arguments);
}
};
In case it makes a difference, I'm totally ok with chilling on 3.1.2 until this gets sorted.
thanks for all your efforts on the library!
cc: @mohsen1 @capaj
@mohsen1 probably stuff works better if we don't use the concatened files in the build (which are stripped further down), but just do a simple build like quickbuild. Downside is that that makes the build much bigger (and a bit slower), but hopefully tree shaking makes up for that :)
@mweststrate please note v3.1.6 somehow got unpublished when you released 3.1.6-fix887.
This broke stuff on our end, as we use exact versions in deps.
Could you please release 3.1.7 to fix this?
See:
https://www.npmjs.com/package/mobx
3.1.6-fix887 is the latest of 72 releases
@AviVahl Released 3.1.7, containing all the changes from 3.1.6 except the es2015 modules
Most helpful comment
@AviVahl Released 3.1.7, containing all the changes from 3.1.6 except the es2015 modules