-
-
Notifications
You must be signed in to change notification settings - Fork 604
-
-
Notifications
You must be signed in to change notification settings - Fork 604
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
Loading FancyTree widget destroys all previous jQueryUI instances #803
Comments
How did you include Fancytree? |
We use Webpack to manage async loading of modules, on demand. We first load our jQueryUI library on application start, and then, when we come to FancyTree usage, we load it separately. Since jQuery is defined globally, loading FancyTree affects this single instance of it. Currently we workaround that issue by just replacing FancyTree's Here is s list of problem code: |
Thanks for reporting this. The module support is new with 2.25 and there are still use cases that need to be fixed.
Does one of this work for you:
resolve: {
...
alias: {
// NOTE: Required to load jQuery Plugins into the *global* jQuery instance:
'jquery': require.resolve('jquery'),
'jquery.fancytree.ui-deps': require.resolve('jquery-ui')
}
},
Maybe it's even simpler if that works, by modifying ...
}(function( $ ) {
if( $.ui ) {
return;
}
$.ui = $.ui || {}; |
Well, first solution would definitely work, but why would we load two instances of jQueryUI, if we already have everything FancyTree needs? This will increase the assets size with no reason, as I see it. Second solution will break your code, as you can not be sure, that existing jQueryUI has everything FancyTree needs, right? So, ideally, every definition in P.S. In order someone else face with such issue, here is our workaround // replace custom jQueryUI build for FancyTree
new webpack.NormalModuleReplacementPlugin(/jquery\.fancytree\.ui-deps/, function (resource) {
if (resource.userRequest) {
const map = {
find: /client\\node_modules\\jquery\.fancytree\\dist\\modules\\jquery\.fancytree\.ui-deps/,
replace: 'client\\sources\\App\\vendor\\jquery\.fancytree\.ui-deps'
};
resource.request = resource.request.replace(map.find, map.replace);
resource.userRequest = resource.userRequest.replace(map.find, map.replace);
resource.resource = resource.resource.replace(map.find, map.replace);
}
}) and our custom // custom jQueryUI replacement, as we already have everything FancyTree needs, except blind-effect
import 'jquery-ui/ui/effects/effect-blind'; |
I was thinking that the alias simply assures that jquery-ui is used instead of jquery.fancytree.ui-deps.js. That's how it worked with the jquery alias at least.
true
I was trying to avoid to patching the original source, since it would be error prone on updates. |
FancyTree includes custom jQueryUI, and loading FancyTree widget destroys all of previous instances of jQueryUI.
Particularly
$.effects
,$.widget
,$.Widget
get completely overwritten, destroying all of custom extensions applied before FancyTree is loaded.Environment
enabled/affected extensions: jQueryUI
The text was updated successfully, but these errors were encountered: