Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can not resolve to correct path when used with webpack5 #60

Open
wayne-liberty opened this issue Dec 13, 2020 · 6 comments
Open

can not resolve to correct path when used with webpack5 #60

wayne-liberty opened this issue Dec 13, 2020 · 6 comments

Comments

@wayne-liberty
Copy link

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.

@elsasslegend
Copy link

same problem, fallbacked to resolve.alias :(

@jakebailey
Copy link

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).

@jgchenu
Copy link

jgchenu commented Jul 21, 2022

Any progress please ?

@taylor-lindores-reeves
Copy link

Any progress?

1 similar comment
@mococa
Copy link

mococa commented Aug 20, 2022

Any progress?

@nyngwang
Copy link

Any brogress?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants