Description
Hi guys!
I just wanted to drop this here for some discussion:
https://knpuniversity.com/screencast/javascript-webpack/provide-plugin#comment-3712073331
tl;dr;
If a jQuery plugin properly uses require (like bootstrap-datepicker), then it appears possible that it will modify a different jquery object than you get in userland when using require('jquery')
. The solution is to add a jquery
alias (Eonasdan/tempus-dominus#1319 (comment)).
This makes sense: each package gets its own set of dependencies, so it would make sense. We should consider adding the jquery alias, possibly when the user enables autoProvidejQuery
. It's tricky, because I want to balance wtf moments and not make more wtf by adding this alias (there are probably some edge case use-cases where the alias could mess something up).
Activity
tdarlic commentedon Jan 28, 2018
Thanks for pointing it out. I couldn't figure this out on my own.
I ended up doing it this way using node path
stof commentedon Apr 3, 2018
that's because a jquery plugin should actually have a peer-dependency to jquery, not a dependency (as it wants to alter the dependency used by the requester instead)
weaverryan commentedon Apr 12, 2018
Yea, so really, if we decide to fix this, it’s because we’re working around a bug in some js library that has done this incorrectly.
stof commentedon Apr 12, 2018
anyway, if you have multiple jQuery copies locally, because some plugins are not declaring their dependencies the right way, you cannot always fix this with an alias (what if they are incompatible versions ?).
So this should get reported to the package.
carsonbot commentedon Feb 4, 2025
Thank you for this issue.
There has not been a lot of activity here for a while. Has this been resolved?