These are chat archives for systemjs/systemjs

23rd
Mar 2016
Cole Diffin
@arcticShadow
Mar 23 2016 00:33

Is it absolutly mandatory to define a module dependency in a module.

i’m trying to do a dynamic require, after inserting the dependency into the config. so i iknow that systemjs can load it, but it’s refusing to

Cole Diffin
@arcticShadow
Mar 23 2016 00:50

Hmm as far as i can tell, it’s telling me that I’m trying to use an dependency before its being loaded, which is impossible.

My options appear to be, mnasssage the config file to indicate the dependency link, or change my require statement to system.import, then act on the result in the ‘then’ (Currently trying this option)

Matthew James Davis
@davismj
Mar 23 2016 01:53
Thanks for your reply, Guy, I'll give it a shot
Guy Bedford
@guybedford
Mar 23 2016 04:46
@arcticShadow that's exactly correct - dynamic requires must be system.import as they are async
Benjamin Lupton
@balupton
Mar 23 2016 04:54
Hi there. I recently published a project called Editions - https://github.com/bevry/editions - which defines a "editions" package.json property that lists the editions and syntaxes and entry or directory that an edition provides - https://github.com/bevry/editions/wiki#defining-editions - I'd like to get the thoughts of System.js users/authors on it, and how to best integrate the two.
https://github.com/bevry/editions/wiki/Examples has some example configurations that are already in use.
@guybedford you may remember some discussions around https://github.com/bevry/esnextguardian - editions serves as the successor for it
I'm imagining something like a package.json property like how rollup does it with jsnext:main or how browserify does it with browser
Or perhaps a specific loader for System.js that reads the editions property
Benjamin Lupton
@balupton
Mar 23 2016 05:10
The minimum needed would just be something to avoid the autoloader, to avoid multiple editions for the user during concatenation
The ideal would be something that picks the right edition for the developer's configuration
The middle ground would be something that picks a common edition (such as confirmed es6+ syntaxes with import)
uday
@udaysingh010788
Mar 23 2016 10:13
how to use third party library with angular 2.0 opentok.js
Cole Diffin
@arcticShadow
Mar 23 2016 19:54
Thanks for the clarification @guybedford Is there documentation around that? Looking back, it is pretty obvious, however prior to figuring it out, I found a number of people asking the same questions, and no answers.
Matt McDaniel
@matt-mcdaniel
Mar 23 2016 22:59
Is there a lightweight version of SystemJS that supports only loading CommonJS modules? I don't need the prefetching and ES6 loading capabilities for my production build.
Gion Kunz
@gionkunz
Mar 23 2016 23:01
I believe the SFX bundles contain such a minimal SystemJS runtime, maybe you consider bundling SFX bundles?
Matt McDaniel
@matt-mcdaniel
Mar 23 2016 23:15
SFX bundles don't allow for dynamic System.import() calls...
Gion Kunz
@gionkunz
Mar 23 2016 23:17
yeah that's true
weltschmerz
@weltschmerz1
Mar 23 2016 23:21
I'm using TypeScript and asked the same question in the Angular room, but realized that this room is possibly a better fit:

I'm having trouble importing a plain old node module that doesn't look like it was developed using TypeScript: https://github.com/sindresorhus/deep-assign

This is what I do in my project:

import deepAssign from 'deep-assign';

and this is how I configured my SystemJS to find the file:

paths: {
  'deep-assign': `${APP_BASE}node_modules/deep-assign`,
  'is-obj': `${APP_BASE}node_modules/is-obj`
},
packages: {
  'deep-assign': {
      main: 'index.js'
    },
  'is-obj': {
      main: 'index.js'
    }
}

Surprisingly, is-object, which is a dependency of the deep-assign package, had to be loaded separately. I'm at a point where my browser finds and loads the file, but they don't seem to really export anything. deepAssign in my import statement at the top is just undefined. Anybody know how to solve this?