-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
ES6 module doesn't work without 'gridstack/dist/jquery' - 2 versions of jquery bundled as a result #1306
Comments
first off For now you can import the entire normal JQUI instead of our custom version (which is 1/5th the size if you don't use any of the UI components) |
Thanks @adumesny I have tried so many variations - including importing |
can you post a reproducible test ? then I can mod |
Will do |
@adumesny here is a sample app I made: |
hey thanks for the sample! import 'jquery';
import 'jquery-ui'; this is probably a general problem hopefully with a fix out there we can re-use, since we have our own copy. Interestingly our version of JQ + JQUI does work (I recall commenting some code that prevented export from happening - will have to ding when I have time). |
@adumesny that's my impression as well that import GridStack from 'gridstack';
// or
import { GridStack } from 'gridstack'; rather than |
you mean you played with the Note that I had to make this change (not sure why to JQ 3.4.1 and likely 3.5.1 has same issue ? // Expose jQuery and $ identifiers, even in AMD
// (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
// and CommonJS for browser emulators (#13566)
//if ( !noGlobal ) { [alain] noGlobal=true when using webpack/TS, yet we compile this in, not AMD load, so always expose
window.jQuery = window.$ = jQuery;
//} and in jq UI 1.12.1 (function( factory ) {
/* [alain] we compile this in so no need to load with AMD
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([ "jquery" ], factory );
} else */{
// Browser globals
factory( jQuery );
}
}(function( $ ) {
... |
In that case it must be done anyway. Since (at least in |
closing this since as it's not a gridstack lib issue, but jquery not exporting jQuery with ES6 import for jqueryui to work. |
got it working in 2.x where I'm able to do this and all works great (though you can't import your own jquery, but we do export $ now). Will push 2.x out hopefully soon... import { GridStack, $ } from 'gridstack';
import 'gridstack/dist/gridstack.css'; |
closing this as solved in 2.0.0-rc and later builds |
FYI this also works in just released 1.2.1 with this: import 'gridstack/dist/jquery';
import 'gridstack/dist/jquery-ui';
import 'gridstack/dist/gridstack-poly'; // optional IE support
import { GridStack } from 'gridstack';
import 'gridstack/dist/gridstack.jQueryUI';
import 'gridstack/dist/gridstack.css'; 2.x is still better (other fixes) and simpler import... |
Hi, |
@gondias no time to focus on jquery - actually spending time removing it! you can't bring your own jquery with 2.x, so I will re-open this. But very soon 3.0 you will be able to use the html5 native drag&drop so your code could use your version of jquery. I don't know how to package this legacy jq code and make it work for everyone. Don't forget to contribute or donate. thanks. |
@adumesny Thanks for the quick reply! |
closing as v3 html5 version is a better workaround (no jquery). |
* fix gridstack#1709 also fix gridstack#1306 I believe. * correct info in Readme for using JQ version and ES6 (tested in Angular app) * changed .ts to include jquery by name instead of location.
Subject of the issue
When importing as ES6 module gridstack doesn't recognize existing jquery import. You must import
gridstack/dist/jquery
for gridstack to work. This results in unnecessary 2 versions of jquery being bundled.Your environment
Steps to reproduce
Uncomment any commented line and comment out
import 'gridstack/dist/jquery'
Expected behaviour
Importing standard jquery should be sufficient for gridstack to work.
Actual behaviour
Instead it results in the following error
The text was updated successfully, but these errors were encountered: