tsconfig-paths-webpack-plugin
tsconfig-paths-webpack-plugin copied to clipboard
can not resolve to correct path when used with webpack5
here is a minimum repo to show this bug: https://github.com/gespiton/tsconfigplugin-issue-with-webpack-5
The test file in packages/fullscreen couldn't be correctly resolved. If we check the output bundle js file we will see
/***/ "../packages/fullscreen/src/entry.ts":
/*!*******************************************!*
!*** ../packages/fullscreen/src/entry.ts ***!
\*******************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", ({ value: true }));
console.log('packages/fullscreen/src/entry.ts loaded');
__export(__webpack_require__(/*! ./test */ "./src/test.ts"));
noted that on the last line, the file path is ./src/test.ts
, which resolves to the file application/src/test.ts
. While the correct resolve path should be like ../packages/fullscreen/src/test.ts
(in webpack 4).
I suppose this has something to do with how webpack5 distinguishes files. But I don't have the knowledge to solve this bug. Wish someone could look into it. For now, I'm planning to use webpack resolve.alias instead of this plugin.
same problem, fallbacked to resolve.alias :(
I too have switched to resolve aliases to work around this; I had this this previously and assumed it was my fault, but there's something going on in the plugin. It's not too much code to read paths and produce aliases, and the output is the same (but it actually works in cases where the file names conflict between paths).
Any progress please ?
Any progress?
Any progress?
Any brogress?