-
Notifications
You must be signed in to change notification settings - Fork 665
[webpack5-plugin]: try to use project-level dependency #5401
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-plugin]: try to use project-level dependency #5401
Conversation
Signed-off-by: Aramis Sennyey <aramissennyeydd@users.noreply.github.com>
Signed-off-by: Aramis Sennyey <aramissennyeydd@users.noreply.github.com>
...hanges/@rushstack/heft-webpack5-plugin/sennyeya-fix-webpack-resolution_2025-10-06-19-00.json
Outdated
Show resolved
Hide resolved
…bpack-resolution_2025-10-06-19-00.json
Signed-off-by: Aramis Sennyey <aramissennyeydd@users.noreply.github.com>
Signed-off-by: Aramis Sennyey <aramissennyeydd@users.noreply.github.com>
Signed-off-by: Aramis Sennyey <aramissennyeydd@users.noreply.github.com>
|
Could you add a build test project to the repository that loads webpack from the project and has a fake webpack config that verifies that the version of "webpack" matches? You will likely either need to install a distinct version of webpack or have it be a link to a fake implementation that only has the bare minimum API. |
Signed-off-by: Aramis Sennyey <aramissennyeydd@users.noreply.github.com>
|
@dmichon-msft I copied |
Signed-off-by: Aramis Sennyey <aramissennyeydd@users.noreply.github.com>
Signed-off-by: Aramis Sennyey <aramissennyeydd@users.noreply.github.com>
Summary
This PR allows the webpack plugin to use the installed version of webpack in the project before resorting to the rig level one.
Details
Have been trying to add better enforcement of webpack dependencies to prevent phantom deps. Started running into issues with this line in webpack, https://github.com/webpack/webpack/blob/main/lib/NormalModule.js#L274-L278 where it expects a single instance of webpack to be used between the project and the rig running the project. If I install webpack directly at the project level, it will (sometimes) explode because the instances are no longer guaranteed to match.
How it was tested
Tested this change locally against our repo and saw a successful build. Let me know if I should add a build-tests for this, I either have to add a stale webpack version or add a contrived peer dependency resolution which seemed less than maintainable.
Impacted documentation