Skip to content

Instantly share code, notes, and snippets.

@zentuit
Created February 1, 2018 19:32
Show Gist options
  • Save zentuit/af24021fa3d95b340413587c4984432e to your computer and use it in GitHub Desktop.
Save zentuit/af24021fa3d95b340413587c4984432e to your computer and use it in GitHub Desktop.
Webpack bundle where the moduleID required is wrong (it is its own number)
/***/ }),
/* 48 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
if (true) {
var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
Symbol.for &&
Symbol.for('react.element')) ||
0xeac7;
var isValidElement = function(object) {
return typeof object === 'object' &&
object !== null &&
object.$$typeof === REACT_ELEMENT_TYPE;
};
// By explicitly using `prop-types` you are opting into new development behavior.
// http://fb.me/prop-types-in-prod
var throwOnDirectAccess = true;
module.exports = __webpack_require__(130)(isValidElement, throwOnDirectAccess);
} else {
// By explicitly using `prop-types` you are opting into new production behavior.
// http://fb.me/prop-types-in-prod
module.exports = require('./factoryWithThrowingShims')();
}
<snip>
/***/ }),
/* 528 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _propTypes = __webpack_require__(528);
var _propTypes2 = _interopRequireDefault(_propTypes);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
<snip>
@zentuit
Copy link
Author

zentuit commented Feb 1, 2018

In our React project we're using some 3rd party components that happen to have modules named prop-types.js. React also has prop-types.js file. Randomly we're seeing times when a 3rd party's prop-types has the wrong __webpack_require__() moduleID. It has its own moduleID.

Has anyone seen this before?

This crashes the app hard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment