gridster.js
                                
                                 gridster.js copied to clipboard
                                
                                    gridster.js copied to clipboard
                            
                            
                            
                        Problem with import library v7 (angular2)
Hi, i have problem when try import library like this import 'dsmorse-gridster/dist/jquery.gridster.min.js' In console i have next error:
Can't resolve './jquery.coords.js'
Can't resolve './utils.js'
Can't resolve './jquery.collision.js'
Can't resolve './jquery.draggable.js'
Problem have because in code have part which try add library if current library was imported.
In library part this is next code if (typeof exports === 'object') { module.exports = factory(require('jquery'), require('./jquery.draggable.js'), require('./jquery.collision.js'), require('./jquery.coords.js'), require('./utils.js')); } Can you fixe it please. This urgent for me :) Thks And sorry for my bad english.
Since you are using angular2 I assume you are loading the script via SystemJS. SystemJS detects the library to be in commonjs format. But the imports for that format seem to be broken. To workaround you can force SystemJS to load the script in amd format:
    meta: {
       "jspm_packages/npm/[email protected]/jquery.gridster.js": {
         "format": "amd"
       }
    }
That worked for me, but the imports for commonjs should be fixed nevertheless.
My problem what I using webpack and this import don't working for me :(
If you have a code change I'd be happy to accept it, but for the record, there are VERY good (if not better) angular versions of this library. I'd recommend leveraging one of those directly.
I find solution. I copy folder src from github to my project. But this very bad solution. And i want ask you add to npm folder src with all file which you use for library Because all project based on ES6/typescript will try import library which not exist in dist folder.
This list import which code can't find
- require('./jquery.draggable.js')
- require('./jquery.collision.js')
- require('./jquery.coords.js')
- require('./utils.js'))
Thank you
utils.js and other files are indeed not included in the npm install.
Same issue here (Typescript, SystemJS), any plans to resolve this?
same here
I think have next solution:
- need remove all import in file which in dist directory
- need add to directory dist next files: jquery.draggable.js, jquery.collision.js, jquery.coords.js, utils.js
- copy src folder from bitbucket and after do some sing: import 'assets/gridster/jquery.gridster.js'; (this forking for me, but bad solution)
I have the same problem!