I have 2 tslib versions in the project
| +-- @typescript-eslint/eslint-plugin@3.10.1
| | `-- tsutils@3.21.0
| | `-- tslib@1.14.1
| `-- eslint@6.8.0
| `-- inquirer@7.3.3
| `-- rxjs@6.6.7
| `-- tslib@1.14.1 deduped
`-- enzyme@3.9.0
`-- cheerio@1.0.0-rc.10
`-- tslib@2.3.0
webpack resolves usage from cheerio to the wrong version of tslib 1.14 which results in runtime error tslib_1.__spreadArray is not a function at
/***/ "./node_modules/cheerio/lib/static.js":
/*!********************************************!*\
!*** ./node_modules/cheerio/lib/static.js ***!
\********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.merge = exports.contains = exports.root = exports.parseHTML = exports.text = exports.xml = exports.html = void 0;
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
can I somehow trace the resolution of modules webpack does ? can it happen because of resolve.modules ?
resolve: {
unsafeCache: true,
aliasFields: ["browser"],
mainFields: ["module", "jsnext:main", "browser", "main"],
modules: [
"./node_modules",
path.resolve(context),
path.resolve(context, "node_modules"),
],
removing webpack resolve.modules "./node_modules" helped
it was indeed hapening because of custom webpack resolve config
some inner module was calling require("foo") and "foo" was taken from the root of node_modules, when appropriate version of foo was located depper
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.