These are chat archives for systemjs/systemjs

25th
Jun 2015
Rob Wormald
@robwormald
Jun 25 2015 01:10
one thing you can do is build a dependency bundle and include that, and then transpile your app code on the fly @Mosho1
Maeoll Kim
@abyss-outpost
Jun 25 2015 01:22
hey @robwormald long time no see.. can you give me a hint on how to add directives using systemjs?
*to angular XD
Rob Wormald
@robwormald
Jun 25 2015 02:21
there's not really a super pretty way to do it really
Maeoll Kim
@abyss-outpost
Jun 25 2015 02:21
yeah i just gave up and made angular.module's in the directive files and loaded them using import x from file
because apparently angular doesnt let you piggyback the ng module anymore X(
Maeoll Kim
@abyss-outpost
Jun 25 2015 02:25
thanks @robwormald, ill take a look when i get a second
Jayson Harshbarger
@Hypercubed
Jun 25 2015 06:20
@nachoaIvarez FYI, what I am doing now is coping all js files to a .tmp directory then bundling to dist. Works ok, but slow.
Teoh Han Hui
@teohhanhui
Jun 25 2015 08:30

I'm using ES6 for my gulpfile ("gulpfile.babel.js"), but I've run into a problem of wanting to do a conditional import (more specifically, do not error out if a package - a dev dependency - is missing)... So I'm trying to use SystemJS:

import gulp from 'gulp';
import System from 'systemjs';

System.transpiler = 'babel';

gulp.task('a-certain-task', function() {
  System.import('browser-sync').then(function(browserSync) {
    ...
  });
});

Unfortunately, this gives me Error: ENOENT: no such file or directory, open '/path/to/project/browser-sync'. Does SystemJS not look under node_modules by default, or is there something I'm doing wrong?

Sharon (Sean) Rolel
@Mosho1
Jun 25 2015 08:57
it doesn't afaik
it looks for whatever is specified in its configuration
Teoh Han Hui
@teohhanhui
Jun 25 2015 08:58
just tried adding system-npm, still can't get it to work..
Sharon (Sean) Rolel
@Mosho1
Jun 25 2015 08:59
you could add a mapping of browser-sync to the config
or try jspm install npm:browser-sync which will create the mapping (and download the package into jspm_packages)
Teoh Han Hui
@teohhanhui
Jun 25 2015 09:00
that defeats the purpose of using a module loader, if i have to configure everything manually.. (i'm not using jspm btw)
Sharon (Sean) Rolel
@Mosho1
Jun 25 2015 09:00
you don't have to configure it manually, that's why you have jspm
but you can add this:
System.config({   
     "paths": {
        "npm:*": "node_modules/*"
      }
})
and then System.import('npm:browser-sync')
Teoh Han Hui
@teohhanhui
Jun 25 2015 09:03
well, my question is, do you know of any simple implementation of System.import that allows me to conditionally load a module ES6-style... or should I just use node's require for such cases?
Sharon (Sean) Rolel
@Mosho1
Jun 25 2015 09:03
I know only of systemjs
it's great and does all things
I suggest you try jspm
Teoh Han Hui
@teohhanhui
Jun 25 2015 09:04
I see that SystemJS/jspm is more catered to frontend use cases in mind...
but i'm only trying to do something simple in a gulpfile :P
Sharon (Sean) Rolel
@Mosho1
Jun 25 2015 09:11
then yeah, use require I guess
Teoh Han Hui
@teohhanhui
Jun 25 2015 09:11
In my case, I should just go back to the good 'ol require:
if (options.env === 'development') {
  browserSync = require('browser-sync');
}
there needs to be a standard way of doing something like this, just saying...
Teoh Han Hui
@teohhanhui
Jun 25 2015 09:38
As for a frontend module loader.. I'm familiar with RequireJS.. still unconvinced that I need/want any node API (shimmed or otherwise) to be in my client script, or that I actually need/want to use npm packages in my frontend code..
Sharon (Sean) Rolel
@Mosho1
Jun 25 2015 10:02
it's not just for npm packages, but recently there has been a migration from github/bower based packages to npm
so you could, for example, install react from npm
or angular, or most packages which can be considered front-end packages
and there are also useful libraries you can use in the front
and it also lends to isomorphic apps
Hans van den Akker
@mysim1
Jun 25 2015 16:42
@teohhanhui we are using System js for cross platform Development. It's never been easier. Sticking to requirejs limits your scenario's. Like using within NW.js. You'll me meshing node.js and client stuff All The time
Guy Bedford
@guybedford
Jun 25 2015 16:43
@teohhanhui a project for a SystemJS-style loader that loads ES6 with the Node resolution algorithm could be created. This will most likely be Node's progression into ES6. SystemJS is focused on the browser though, not this server use case
Teoh Han Hui
@teohhanhui
Jun 25 2015 19:11
I'm using systemjs (with jspm) now, and it's been mostly wonderful..
but how do I do something like this? http://requirejs.org/docs/jquery.html#noconflictmap
you should probably correct the documentation which says systemjs supports "RequireJS-style map"... it's totally unrelated to systemjs's map config.. the closest thing you have is packages