-
Notifications
You must be signed in to change notification settings - Fork 72
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
Fix builds of VueJS 2 version in webpack@5 #108
base: master
Are you sure you want to change the base?
Conversation
I cannot use this library in our app running on Vue2 and built with webpack v5. The error that I get is: > Module not found: Error: Package path ./v2 is not exported from package /Users/korya/dev/issue-webpack5-lazy-image/node_modules/v-lazy-image (see exports field in /Users/korya/dev/issue-webpack5-lazy-image/node_modules/v-lazy-image/package.json) The proposed change fixes the problem. I've created a minimal repo that demonstrates the problem https://github.com/korya/issue-webpack5-lazy-image/ and has some more details. Also, this repo has 2 CI jobs defined (https://github.com/korya/issue-webpack5-lazy-image/actions/runs/2324999565): - `build-as-is` that tries to build the project with the original `package.json` and fails - `build-fixed` that tries to build the project with the updated `package.json` and succeeds
hey 🙂 , would you mind merging this change? We need to use v2 and we have this issue too. I tried to apply your commit in node_modules and it works perfectly 👍 . |
Hey! We also ran into the same issue. Would be great if you could merge this fix. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We too are facing this issue in our project, please merge it team!
Same issue in our project, a merge would be great, having to use v1.4.0 for now! |
We've added a post-install script to patch the package in Updates to {
...,
"scripts": {
...,
"postinstall": "./script/post-install.sh"
},
...
} The contents of #!/bin/bash
set -e
# XXX: Manually patch package.json of `v-lazy-image` to let webpack@5 build it
# successfully.
# For more details, refer to https://github.com/alexjoverm/v-lazy-image/pull/108
if [[ ! -f node_modules/v-lazy-image/package.json.original ]]; then
echo -e "\n\nPatching 'node_modules/v-lazy-image/package.json'..."
cp node_modules/v-lazy-image/package.json{,.original}
patch -p1 <<EOF
--- old/node_modules/v-lazy-image/package.json 2022-05-14 15:29:41.853865169 -0400
--- new/node_modules/v-lazy-image/package.json 2022-05-14 15:29:41.853865169 -0400
@@ -34,6 +34,10 @@
".": {
"import": "./dist/v-lazy-image.mjs",
"require": "./dist/v-lazy-image.js"
+ },
+ "./v2": {
+ "import": "./v2/v-lazy-image.mjs",
+ "require": "./v2/v-lazy-image.js"
}
},
"jest": {
EOF
echo -e "OK. Patched 'node_modules/v-lazy-image/package.json' successfully.\n\n"
else
echo -e "\n\nSkipped patching 'node_modules/v-lazy-image/package.json'.\n\n"
fi |
@alexjoverm is it possible for you to merge this PR please? It would help us solving our problems without any forks or workarounds. thx |
I cannot use this library in our app running on Vue2 and built with webpack v5. The error that I get is:
The proposed change fixes the problem.
I've created a minimal repo that demonstrates the problem https://github.com/korya/issue-webpack5-lazy-image/ and has some more details.
Also, this repo has 2 CI jobs defined (https://github.com/korya/issue-webpack5-lazy-image/actions/runs/2324999565):
build-as-is
that tries to build the project with the originalpackage.json
and failsbuild-fixed
that tries to build the project with the updatedpackage.json
and succeedsThis PR should solve #106