-
-
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
When used in browserify, gridstack is not correctly exported, which breaks the gridstack jquery drag plugin #643
Comments
To add to this, when I alter the gridstack source code to explicitly export using |
I think this might also be why importing 0.3.0 in Aurelia breaks (#613) |
Thanks, @jaapz ! We'll look into this. Thanks for providing the Backbone example. |
@jaapz also, do you want to put in a PR, or provide more example code? |
I'll try to look into this some more later today, and see if I can find the time to put in a PR |
@jaapz Have you had any time for this? I spent awhile on it but got very lost. I'm not great at this exporting code. |
@jaapz Can you please provide example code how this works and what you have changed? |
So, during a run of dependency upgrades (bootstrap 3 -> 4, jquery to latest version, you know the drill) I came across this issue and decided that after more than a year my "later today" has finally come ;) I fixed the issue on the latest version of develop and opened a pull request. I'm currently using that fixed repository in our browserify build which seems to work fine. Would be great to get this in a release so we can finally close this! @rpionke for now you can use our repo at AdvancedClimateSystems/gridstack.js as it has the fix which correctly exports gridstack for commonjs and requirejs. That repo will only stay up until the fix is released though, after that I will remove it (which will break your builds)! |
@jaapz Thanks for your response and help! I'm using |
I'm trying to move from 0.2.x to 0.3.0, however the module exporting code is not compatible with Browserify (or probably any CommonJS system).
The jQueryUI drag and drop plugin never correctly initializes.
This is because it is calling
Which always returns an empty object, because the
gridstack.js
file never actually exports anything, but instead "exports" to the globalwindow
scope, as seen ingridstack.js
line 20:And
gridstack.js
line 1729:exports
is never actually used, so callingrequire('gridstack')
will then always return an empty object.So I think the module loading code for both
gridstack.js
andgridstack.jQueryUI.js
should be altered to export using themodule.exports
CommonJS pattern.I think a good way to do this is looking at how backbonejs does this.
The text was updated successfully, but these errors were encountered: