These are chat archives for systemjs/systemjs

5th
Jan 2016
Jayson Harshbarger
@Hypercubed
Jan 05 2016 01:58
@DavidGangel Maybe I don't understand your question/issue... if JSPM detects that a lib has a require('crypto') it will adds jspm/nodelibs-crypto which shims crypto-browserify for the browser. This is not need with npm install because crypto is internal to node [https://nodejs.org/api/crypto.html].
Sandeep Srinivasa
@sandys
Jan 05 2016 07:03
is anyone using systemjs with expressjs ? am not able to figure out how to get it to work
zackschuster
@zackschuster
Jan 05 2016 09:14
hey all, i recently published a js bundling tool that leverages systemjs, i'd love to hear y'alls feedback :) https://www.npmjs.com/package/autobundler
i have lots of work ahead on it but i'm really proud of it so far
Simon Hampton
@simonh1000
Jan 05 2016 13:46
Hi all, I have a angular setup that runs in development, but when I use

Hi all, I have a angular setup that runs in development, but when I try to build it

var Builder = require('systemjs-builder');
var builder = new Builder('./src', './src/config.js');
gulp.task('bundle', function (cb) {
    builder.buildStatic('./src/app.js', './dist/build.js', { minify: true})
    .then(function() {
        cb();
    })
    .catch( function(err) {console.error(err)} );
});

I end up with angular is not defined because angular (1.4) is being added to the bundle near the end and after various things that call it. What i can look out for?

Jayson Harshbarger
@Hypercubed
Jan 05 2016 14:34
@simonh1000 do you have a example. Sounds like you are importing a file that needs angular before you are importing angular.
Chris Grant
@ChrisGrant
Jan 05 2016 15:03

I'm struggling to get my angular app to run. It works about 50% of the time, but then other times I get the following errors from systemjs. Does anyone have any idea why? I guess it's a timing thing but I can't figure out how to solve it. Basically I don't know where to start to try and solve the problem.

GET http://localhost:9000/angular2/platform/browser.js 404 (Not Found)
GET http://localhost:9000/angular2/router.js 404 (Not Found)
Error: XHR error (404 Not Found) loading http://localhost:9000/angular2/platform/browser.js(…)

The files on the server are actually located under the 'node_modules' folder. They're being included in my index.html like this:

<script src="node_modules/angular2/bundles/angular2-polyfills.js"></script>
  <script src="node_modules/systemjs/dist/system.src.js"></script>

  <!-- 2. Configure SystemJS -->
  <script>
  System.defaultJSExtensions = true;
  System.config({
    packages: {
      tmp: {
        format: 'register'
      }
    }
  });
  System.import('tmp/boot').
  then(null, console.error.bind(console));
  </script>

  <script src="node_modules/rxjs/bundles/Rx.js"></script>
  <script src="node_modules/angular2/bundles/angular2.dev.js"></script>
  <script src="node_modules/angular2/bundles/router.dev.js"></script>
shubhamMuttepawar
@shubhamMuttepawar
Jan 05 2016 17:43
@ChrisGrant Try including es6-shim.js as well. worked for me.
Chris Grant
@ChrisGrant
Jan 05 2016 17:44
okay thanks I will give it a go @shubhamMuttepawar
@shubhamMuttepawar i'm getting the same issue unfortunately
Chris Grant
@ChrisGrant
Jan 05 2016 17:51
@shubhamMuttepawar did you include it at the very start?
shubhamMuttepawar
@shubhamMuttepawar
Jan 05 2016 17:52
@ChrisGrant Maybe Its different issue then. Still just see if you can track the file from where you are getting this error. I got the same exact error and including es6-shim solved it.
Chris Grant
@ChrisGrant
Jan 05 2016 17:53
Well the problem is that im getting this error because it's looking in the wrong place. It should be looking in http://localhost:9000/node_modules/angular2/platform/browser.js, not http://localhost:9000/angular2/platform/browser.js. The first path includes node_modules.
but i dont know how to get it to look in node_modules
Bnaya Peretz
@Bnaya
Jan 05 2016 18:04
I'm having truble setting the jspm_packages as sibling to the the src dir in the
Dose anyone here done it?
warn jspm_packages must be specified in the package.json within the baseURL for paths to resolve correctly.
Hmm
Guy Bedford
@guybedford
Jan 05 2016 18:12
@Bnaya it's a common issue
baseURL must be the lowest path in the app
Bnaya Peretz
@Bnaya
Jan 05 2016 18:13
Well i guess its a must if you want to support developemt without build step
Bnaya Peretz
@Bnaya
Jan 05 2016 18:31
Oh my, its a serious issue for me.
I'm developing with build step (jspm-dev-builder) and i need the jspm_packages out of my src folder
Guy Bedford
@guybedford
Jan 05 2016 18:32
@Bnaya that's fine, but then your src folder must be a subfolder of the baseURL
that can be setup with paths or otherwise
Bnaya Peretz
@Bnaya
Jan 05 2016 18:35
is there a way i can tell jspm to look for the config.js file not in the baseURL?
Got it
  "jspm": {
    "configFile": "dir/config.js",
Bnaya Peretz
@Bnaya
Jan 05 2016 18:44

@guybedford is it possbile map doesn't pass the extension of the file?

  paths: {
    "github:*": "jspm_packages/github/*",
    "npm:*": "jspm_packages/npm/*",
    "Photomania/*": "src/Photomania/*",
  },

  packages: {
    "Photomania": {
      "defaultExtension": false,
      "defaultJSExtensions": false
    }
  },

This try to load my files that under Photomania without .js even it specified in the import

I need something like
 "Photomania/*": "src/Photomania/*.js|.jsx",
    "Photomania/*.jsx": "src/Photomania/*.jsx",
    "Photomania/*.js": "src/Photomania/*.js"
makes some progress, but it adds jsx.js to jsx files
Bnaya Peretz
@Bnaya
Jan 05 2016 18:58

Ok thats works for me:

paths: {
    "github:*": "jspm_packages/github/*",
    "npm:*": "jspm_packages/npm/*",
    "Photomania/*.jsx": "src/Photomania/*.jsx",
    "Photomania/*.js": "src/Photomania/*.js",
    "Photomania/*.json": "src/Photomania/*.json"
  },

  packages: {
    "src/Photomania": {
      "defaultExtension": false,
      "defaultJSExtensions": false
    }
  },

You need to specify mapping for each extension separately

Simon Hampton
@simonh1000
Jan 05 2016 19:02
@Hypercubed it seems to have something to do with my import of Immutable.js in a component. I'm not using Immutable yet, and removing that seems to have sorted out the issue for the time being