-
Notifications
You must be signed in to change notification settings - Fork 754
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
jQuery dependency cause double require of module using webpack #1411
Comments
I also have trouble using this with webpack. I have to manually assign |
@MartinMuzatko i downgraded to 2.28.8, because can't for 2.28.9 for some reason. |
Hi @mrsombre! Bootstrap 3.3.7 supports jQuery 3.0+ so a change to the dependency shouldn't be necessary. It looks like I forgot to publish v2.28.9 to npm. The current version is 2.28.12. Did you use |
Thank you for the feedback @Mottie. { test: require.resolve('jquery'), loader: 'expose?jQuery!expose?$'}, But when I |
I'm not sure what might be missing, but check out this StackOverflow answer: https://stackoverflow.com/a/28989476/145346 The way I found works is something like this: module.exports = {
entry: [
'script!jquery/dist/jquery.min.js',
'script!tablesorter/dist/js/jquery.tablesorter.min.js'
],
externals: {
jquery: 'jQuery'
},
plugins: [
new webpack.ProvidePlugin({
'$': 'jquery',
'jQuery': 'jquery'
})
],
// ...
} |
@Mottie we using jquery 2.4 for some reasons, i don't know, maybe our frontend guys knows, BTW what the problem with or in dependency. I'm explain how it works Example webpack code
Last version tablesorter with jquery 3 dependency
Old version tablesorter with jquery >1 dependency
Also, there are double jquery in my bundle.js and in this case tablesorted has not exposed to global scope, so i can't use it at site pages, only in my bundle.js |
@mrsombre so to solve this all I'd need to do is to set the jQuery dependency to |
@Mottie i think so, would be great |
Never heard of jQuery 2.4, WP does not know it either: https://en.wikipedia.org/wiki/JQuery#Release_history I guess you mean 2.2.4 (latest before 3). |
Actually, I'm going to change it back to |
This fix will be available with the next release, which will be likely be tomorrow. |
We are using webpack for building JS and bootstrap 3 (which has not support jquery 3 yet). In this case, tablesorter dependency install separate jquery 3 and using it in webpack, instead of main jquery 2 and we can not use tablesorter from global scope.
Consider change dependency to "jquery": "^2.4 | ^3.2" from "jquery": ">=3.2.1" to fix this issue.
The text was updated successfully, but these errors were encountered: