akveo / ng2-smart-table

Angular Smart Data Table component
https://akveo.github.io/ng2-smart-table/
MIT License
1.63k stars 877 forks source link

System.js or minified library #70

Open dbogdantech101 opened 8 years ago

dbogdantech101 commented 8 years ago

Trying to integrate with angular2 using system.js. Installed with npm and then pointed system.js to ng2-smart-table.js in /build. However, it has a problem with

__export(require('./src/ng2-smart-table/lib'));

in ng2-smart-table.js as it tries to find lib.js and fails. If I take that line out, it fails with:

zone.js:1382 GET http://192.168.33.11:1337/node_modules/ng2-smart-table/build/src/ng2-smart-table/ng2-smart-table.scss.js 404 (Not Found)scheduleTask @ zone.js:1382ZoneDelegate.scheduleTask @ zone.js:245Zone.scheduleMacroTask @ zone.js:171(anonymous function) @ zone.js:1405send @ VM12074:3fetchTextFromURL @ system.src.js:1156(anonymous function) @ system.src.js:1739ZoneAwarePromise @ zone.js:518(anonymous function) @ system.src.js:1738(anonymous function) @ system.src.js:2764(anonymous function) @ system.src.js:3338(anonymous function) @ system.src.js:3605(anonymous function) @ system.src.js:3990(anonymous function) @ system.src.js:4453(anonymous function) @ system.src.js:4705(anonymous function) @ system.src.js:408ZoneDelegate.invoke @ zone.js:232Zone.run @ zone.js:114(anonymous function) @ zone.js:502ZoneDelegate.invokeTask @ zone.js:265Zone.runTask @ zone.js:154drainMicroTaskQueue @ zone.js:401ZoneTask.invoke @ zone.js:339 (index):99 Error: Error: XHR error (404 Not Found) loading http://192.168.33.11:1337/node_modules/ng2-smart-table/build/src/ng2-smart-table/ng2-smart-table.scss.js(…)(anonymous function) @ (index):99ZoneDelegate.invoke @ zone.js:232Zone.run @ zone.js:114(anonymous function) @ zone.js:502ZoneDelegate.invokeTask @ zone.js:265Zone.runTask @ zone.js:154drainMicroTaskQueue @ zone.js:401ZoneTask.invoke @ zone.js:339 zone.js:1382 GET http://192.168.33.11:1337/node_modules/ng2-smart-table/build/src/ng2-smart-table/ng2-smart-table.html.js 404 (Not Found)scheduleTask @ zone.js:1382ZoneDelegate.scheduleTask @ zone.js:245Zone.scheduleMacroTask @ zone.js:171(anonymous function) @ zone.js:1405send @ VM12074:3fetchTextFromURL @ system.src.js:1156(anonymous function) @ system.src.js:1739ZoneAwarePromise @ zone.js:518(anonymous function) @ system.src.js:1738(anonymous function) @ system.src.js:2764(anonymous function) @ system.src.js:3338(anonymous function) @ system.src.js:3605(anonymous function) @ system.src.js:3990(anonymous function) @ system.src.js:4453(anonymous function) @ system.src.js:4705(anonymous function) @ system.src.js:408ZoneDelegate.invoke @ zone.js:232Zone.run @ zone.js:114(anonymous function) @ zone.js:502ZoneDelegate.invokeTask @ zone.js:265Zone.runTask @ zone.js:154drainMicroTaskQueue @ zone.js:401ZoneTask.invoke @ zone.js:339 zone.js:1382 GET http://192.168.33.11:1337/node_modules/ng2-smart-table/build/src/ng2-smart-table/components/cell/cell.scss.js 404 (Not Found)scheduleTask @ zone.js:1382ZoneDelegate.scheduleTask @ zone.js:245Zone.scheduleMacroTask @ zone.js:171(anonymous function) @ zone.js:1405send @ VM12074:3fetchTextFromURL @ system.src.js:1156(anonymous function) @ system.src.js:1739ZoneAwarePromise @ zone.js:518(anonymous function) @ system.src.js:1738(anonymous function) @ system.src.js:2764(anonymous function) @ system.src.js:3338(anonymous function) @ system.src.js:3605(anonymous function) @ system.src.js:3990(anonymous function) @ system.src.js:4453(anonymous function) @ system.src.js:4705(anonymous function) @ system.src.js:408ZoneDelegate.invoke @ zone.js:232Zone.run @ zone.js:114(anonymous function) @ zone.js:502ZoneDelegate.invokeTask @ zone.js:265Zone.runTask @ zone.js:154drainMicroTaskQueue @ zone.js:401ZoneTask.invoke @ zone.js:339 zone.js:1382 GET http://192.168.33.11:1337/node_modules/ng2-smart-table/build/src/ng2-smart-table/components/filter/filter.scss.js 404 (Not Found)scheduleTask @ zone.js:1382ZoneDelegate.scheduleTask @ zone.js:245Zone.scheduleMacroTask @ zone.js:171(anonymous function) @ zone.js:1405send @ VM12074:3fetchTextFromURL @ system.src.js:1156(anonymous function) @ system.src.js:1739ZoneAwarePromise @ zone.js:518(anonymous function) @ system.src.js:1738(anonymous function) @ system.src.js:2764(anonymous function) @ system.src.js:3338(anonymous function) @ system.src.js:3605(anonymous function) @ system.src.js:3990(anonymous function) @ system.src.js:4453(anonymous function) @ system.src.js:4705(anonymous function) @ system.src.js:408ZoneDelegate.invoke @ zone.js:232Zone.run @ zone.js:114(anonymous function) @ zone.js:502ZoneDelegate.invokeTask @ zone.js:265Zone.runTask @ zone.js:154drainMicroTaskQueue @ zone.js:401ZoneTask.invoke @ zone.js:339 zone.js:1382 GET http://192.168.33.11:1337/node_modules/ng2-smart-table/build/src/ng2-smart-table/components/pager/pager.scss.js 404 (Not Found)scheduleTask @ zone.js:1382ZoneDelegate.scheduleTask @ zone.js:245Zone.scheduleMacroTask @ zone.js:171(anonymous function) @ zone.js:1405send @ VM12074:3fetchTextFromURL @ system.src.js:1156(anonymous function) @ system.src.js:1739ZoneAwarePromise @ zone.js:518(anonymous function) @ system.src.js:1738(anonymous function) @ system.src.js:2764(anonymous function) @ system.src.js:3338(anonymous function) @ system.src.js:3605(anonymous function) @ system.src.js:3990(anonymous function) @ system.src.js:4453(anonymous function) @ system.src.js:4705(anonymous function) @ system.src.js:408ZoneDelegate.invoke @ zone.js:232Zone.run @ zone.js:114(anonymous function) @ zone.js:502ZoneDelegate.invokeTask @ zone.js:265Zone.runTask @ zone.js:154drainMicroTaskQueue @ zone.js:401ZoneTask.invoke @ zone.js:339 zone.js:1382 GET http://192.168.33.11:1337/node_modules/ng2-smart-table/build/src/ng2-smart-table/components/title/title.scss.js 404 (Not Found)

I've also tried running tsc on your git repo but it doesn't seem to provide any minified files.

Could you provide steps to get system.js working or provide a minified library thats easier to include?

renooo commented 7 years ago

@dbogdantech101 I solved the problem for lib.js by adding a new entry for it in systemjs.config.js, but I still have 404 on the .html.js and .scss.js files (wrongly suffixed with .js extension).

(function (global) {
  System.config({
    paths: {
      // paths serve as alias
      'npm:': 'node_modules/'
    },
    // map tells the System loader where to look for things
    map: {
      // ...
      'ng2-smart-table': 'npm:ng2-smart-table',
      'ng2-smart-table/lib': 'npm:ng2-smart-table/build/src/ng2-smart-table/lib'
    },
    packages: {
      'smart-table': {
        main: 'build/ng2-smart-table.js'
      },
      'ng2-smart-table/lib': {
        main: 'index.js'
      }
    }
  });
})(this);
renooo commented 7 years ago

Actually, it could be working like this :

(function (global) {
  System.config({
    paths: {
      // paths serve as alias
      'npm:': 'node_modules/'
    },
    // map tells the System loader where to look for things
    map: {
      // ...
      'ng2-smart-table': 'npm:ng2-smart-table',
      'ng2-smart-table/lib': 'npm:ng2-smart-table/build/src/ng2-smart-table/lib',
    },
    // packages tells the System loader how to load when no filename and/or no extension
    packages: {
      // ...
      'ng2-smart-table': {
        main: 'build/ng2-smart-table.js',
        meta: {
          '*.html': {},
          '*.scss': {}
        }
      },
      'ng2-smart-table/lib': {
        main: 'index.js'
      }
    }
  });
})(this);
molyviatisl commented 7 years ago

doesn't work for me