Thanks to visit codestin.com
Credit goes to github.com

Skip to content

When used in browserify, gridstack is not correctly exported, which breaks the gridstack jquery drag plugin #643

Closed
@jaapz

Description

@jaapz

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

try { GridStackUI = require('gridstack'); } catch(e) {}

Which always returns an empty object, because the gridstack.js file never actually exports anything, but instead "exports" to the global window scope, as seen in gridstack.js line 20:

var scope = window;

And gridstack.js line 1729:

scope.GridStackUI = GridStack;

exports is never actually used, so calling require('gridstack') will then always return an empty object.

So I think the module loading code for both gridstack.js and gridstack.jQueryUI.js should be altered to export using the module.exports CommonJS pattern.

I think a good way to do this is looking at how backbonejs does this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions