These are chat archives for systemjs/systemjs

15th
Apr 2016
audeamus22
@audeamus22
Apr 15 2016 16:01
This message was deleted
weltschmerz
@weltschmerz1
Apr 15 2016 17:28

Is there a way to use npm packages that were originally only built for node with Angular through SystemJS? For example, I really want to use this one: https://www.npmjs.com/package/semver. But I'm having trouble including it properly.

The semver package uses module.exports, and I think this should be covered by Systemjs according to this? https://github.com/systemjs/systemjs/blob/master/docs/module-formats.md#commonjs

My systemjs config looks like this:
{
  defaultJSExtensions: true,
  paths: {
    'semver': `${APP_BASE}node_modules/semver`
  },
  packages: {
    'semver': {
      main: 'semver.js',
      format: 'cjs'
    }
  }
}
Manuel Pacheco
@ShadowManu
Apr 15 2016 17:34
@dchacke try using JSPM. It will make this simpler and help you understand a little more about the config.js (in particular, the way you use the paths property I believe is not very adequate).
if memory (and intutiton) serves right, simply doing jspm install semver should work instantly. Try it ;)
weltschmerz
@weltschmerz1
Apr 15 2016 17:35
thanks, but not sure switching over to jspm is an option right now
is there any way to do it with plain systemjs?
Manuel Pacheco
@ShadowManu
Apr 15 2016 17:37
haven't done it the plain way.
weltschmerz
@weltschmerz1
Apr 15 2016 17:37
ok thanks
Manuel Pacheco
@ShadowManu
Apr 15 2016 17:38
Try using the map property. Maybe this video can help you (since lets admit SystemJS needs help on the doc department) --> https://www.youtube.com/watch?v=szJjsduHBQQ
weltschmerz
@weltschmerz1
Apr 15 2016 17:41
cool thank you :)