mobx: 3.1.12 breaks webpack build
Working for 3.1.11, broken for 3.1.12
Webpack does not emit any errors at build time, but the code will not run:
mobx.module.js:3335 Uncaught ReferenceError: exports is not defined
at Object.<anonymous> (mobx.module.js:3335)
at Object.defineProperty.value (mobx.module.js:3335)
at __webpack_require__ (bootstrap 81606c5…:19)
at Object.defineProperty.value (gui.tsx:19) (require mobx)
at __webpack_require__ (bootstrap 81606c5…:19)
at Object.<anonymous> (main.tsx:5)
at Object.setPrototypeOf.__proto__ (main.tsx:109)
at __webpack_require__ (bootstrap 81606c5…:19)
at module.exports (bootstrap 81606c5…:65)
at bootstrap 81606c5…:65
The emitted code looks like this:
export { extras, Reaction, untracked, IDerivationState, Atom, BaseAtom, useStrict, isStrictModeEnabled, spy, asReference, asFlat, asStructure, asMap, isModifierDescriptor, isObservableObject, isObservableValue as isBoxedObservable, isObservableArray, ObservableMap, isObservableMap, map, transaction, observable, IObservableFactories, computed, isObservable, isComputed, extendObservable, extendShallowObservable, observe, intercept, autorun, autorunAsync, when, reaction, action, isAction, runInAction, expr, toJS, createTransformer, whyRun, isArrayLike };export default exports;
exports is not defined.
Webpack configuration excerpt:
loaders: [
{
test: /\.jsx?$/,
exclude: path => path.split("/").filter(x => x === "node_modules").length >= 2,
loader: 'babel-loader',
query: {
presets: ['es2015', 'react'],
plugins: ['transform-decorators-legacy', 'transform-class-properties']
}
},
{
test: /\.tsx?$/,
exclude: path => path.split("/").filter(x => x === "node_modules").length >= 2,
loader: 'ts-loader',
options: {
transpileOnly: true
}
},
All our code is contained in a folder called node_modules, not sure if that’s relevant. Edit: probably not
I’m guessing this is caused by https://github.com/mobxjs/mobx/commit/823b713f2f44078b4e2cd3bea94ce3082f61f011
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 7
- Comments: 27 (11 by maintainers)
Ugh… I thought I fixed this. Sorry everyone, I’ll get a PR up right away to address it
Released 3.1.14. Please let us know if this causes trouble again!
Phew. Sorry guys! Anybody wants to volunteer to run a webpack 1 & webpack 2 build & run to the test suite? (Sad that this is even needed…)