-
Notifications
You must be signed in to change notification settings - Fork 51
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
webpack5 resolve file error in monorepo #76
Comments
I will look at this in near future |
Having exactly the same issue. Can you provide a fix please ? |
Any news on this issue? |
We have the same problem in our project. That makes it impossible to use webpack 5 |
Hello any news on this ? I have the same issue. We have packageA a that have a file default-theme.ts in the folder theme. We have a service that usage packageA but it also have a default-theme.ts in the same folder theme. It seams that default-theme from the service override the default-theme.ts from the packageA I've been also built a code sandbox where it can be tested
They both have the same files, the only think is different is the webpack version. I've created a dummy package for test purpose with this folder structure: Notice that in the webpack 5 version test variable get replaced |
+1 bump. Having the same issue. I decided to not use this plugin since there didn't seem to be a nice workaround. I ended up just using webpack alias so that I could move my work forward.
|
@await-ovo Did you still use this plugin afterward? |
Bug report
What is the current behavior?
I use webpack 5 with this plugin in a simple yarn workspaces monorepo, Which contain a simple add and a common util library. But there is an error reported:
If the current behavior is a bug, please provide the steps to reproduce.
This is a repo to reproduce: test-monorepo.
git clone https://github.com/diem98/test-monorepo.git
cd test-monorepo && yarn
cd apps/web-app
yarn dev
After that, you can see the error in the figure above.
apps/web-app/src/App.tsx
content as below:You can see that import
addOne
fromcommon-tools
package and importadd
function from it's own utils directory.packages/common-tools
export detail as below:But inside the dist, it is like this:
You will find that import
./utils
incommon-tools/src/add.ts
compiled to./src/utils/index.js
, This leads to the error described above.What is the expected behavior?
It should compile successfully as it did in webpack 4.
I tried to dive into the plugin source code, The
getInnerRequest
return value was found to be differentIn webpack 4
./utils
just returns as expected:./src/utils
. But In webpack 5,./utils
returnssrc/utils
.So in webpack 5 it will execute the following
matchPath
function. then./utils
request incommon-tools/src/add.ts
resolved toapps/web-app/src/utils/index.js
.I found that the different results are related to the different versions of the enhanced-resolve implementation. But I don't know if it was done intentionally.
Thank you very much for your help, and please forgive my broken English.
Other relevant information:
webpack version: 5.32
Node.js version: 14.15.4
Operating System: macos
The text was updated successfully, but these errors were encountered: