-
Notifications
You must be signed in to change notification settings - Fork 301
Description
We've run into a strange issue with code compilation by ncc resulting in a crashing program on Windows 10. A repo has been created that has been verified to exhibit this issue, here: https://github.com/urbdyn/ncc-bug-1
The bug results in code within Knex.js replacing string matches on imports with full paths. The repo has great amounts of detail and compiled output from a Windows and MacOS machine for comparison.
The resulting compiled code in question that seems to be resulting for this look like this on MacOS (works fine, non-buggy):
/***/ 71330:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
function __ncc_wildcard$0 (arg) {
if (arg === "mssql") return __webpack_require__(19427);
else if (arg === "mysql") return __webpack_require__(75941);
else if (arg === "mysql2") return __webpack_require__(17653);
else if (arg === "oracle") return __webpack_require__(9051);
else if (arg === "oracledb") return __webpack_require__(25310);
else if (arg === "postgres") return __webpack_require__(64482);
else if (arg === "redshift") return __webpack_require__(97332);
else if (arg === "sqlite3") return __webpack_require__(85370);
}
but for some reason is transformed into the following in a Windows environment:
/***/ 71330:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
function __ncc_wildcard$0 (arg) {
if (arg === "C:/code/urbdyn/ncc-bug-1/node_modules/knex/lib/dialects/") return __webpack_require__(19427);
else if (arg === "C:/code/urbdyn/ncc-bug-1/node_modules/knex/lib/dialects/") return __webpack_require__(75941);
else if (arg === "C:/code/urbdyn/ncc-bug-1/node_modules/knex/lib/dialects/") return __webpack_require__(17653);
else if (arg === "C:/code/urbdyn/ncc-bug-1/node_modules/knex/lib/dialects/") return __webpack_require__(9051);
else if (arg === "C:/code/urbdyn/ncc-bug-1/node_modules/knex/lib/dialects/") return __webpack_require__(25310);
else if (arg === "C:/code/urbdyn/ncc-bug-1/node_modules/knex/lib/dialects/") return __webpack_require__(64482);
else if (arg === "C:/code/urbdyn/ncc-bug-1/node_modules/knex/lib/dialects/") return __webpack_require__(97332);
else if (arg === "C:/code/urbdyn/ncc-bug-1/node_modules/knex/lib/dialects/") return __webpack_require__(85370);
}
As you can see, something very strange is occurring here which is resulting in a string comparison being replaced by the same directory path, in a hard coded manner.
I did do a bit of research on other issues in this repo and, after a bit more digging, that this seems to be a similar issue to #451.
Don't hesitate to let us know if you need any more information! Full environment details for the systems are given in the example repo.
Tagging @josh-josh-miller for visibility since he is also affected by this problem.