These are chat archives for systemjs/systemjs

4th
Sep 2015
Micah Zoltu
@MicahZoltu
Sep 04 2015 04:11
@MeoMix That or get CORS setup.
I solved this by creating a CORS proxy.
Sean Anderson
@MeoMix
Sep 04 2015 04:29
Don't really feel like doing that just to load analytics :p but fair
Guy Bedford
@guybedford
Sep 04 2015 10:03
@MeoMix it should load correctly if you tell SystemJS ahead of time it is AMD global via -
System.config({
  meta: {
    'https://www.google-analytics.com/analytics.js': {
      exports: 'ga',
      format: 'global'
    }
  }
});
that is - when you fully define a global meta ahead of time, it will know it can use <script> injection fine and work when CORS is not enabled
johnman
@johnman
Sep 04 2015 10:07
@guybedford hi guy any thoughts about my testing question with regards to systemjs and swapping out dependencies? Thanks
Guy Bedford
@guybedford
Sep 04 2015 10:10
@johnman sure, there are three techniques here:
  1. Clone the loader (https://github.com/systemjs/systemjs/blob/master/docs/system-api.md#systemconstructor) and create a context for each test that has mocks set up via map config
  2. Swap out modules using the System.get, set and delete APIs (https://github.com/systemjs/systemjs/blob/master/docs/system-api.md#systemgetmodulename---module), in combination with System.normalizeSync to get the full normalized name to use in those functions
  3. Not encouraged, but System.define(moduleName, stringSource) should also work (provided the module has been deleted first)
The above should probably be documented somewhere, I just havent' had the time to go through and get that all crystal clear
johnman
@johnman
Sep 04 2015 10:24
thanks. Will give them a try. Just trying to work out why my test setup has stopped working. New versions of npm modules perhaps so just trying to get to the bottom of it. Cheers for the tips
λex Vincent
@alexisvincent
Sep 04 2015 10:24
@guybedford Any thoughts on my above question?
Guy Bedford
@guybedford
Sep 04 2015 10:29
@alexisvincent this workflow is still kind of evolving. The only way to really do it currently would be to link in your package with a "registry: npm" set, but linking workflows aren't going to be fun for development until the next release. May just be best to write a plain npm package and make sure it runs well in jspm with relevant configs.
λex Vincent
@alexisvincent
Sep 04 2015 10:39
@guybedford I’ve given it some thought and I think I might be able to pull it off using jspm in parallel, seeing as its only really required when building the bundled lib… What is your plan for this workflow in the future? Surely it makes sence to implement npm style lib lookups as well as jspm. Perhaps this doesnt push jspm as much… But jspm has more then enough of its own merits not to just need systemjs to ‘market’ it.
λex Vincent
@alexisvincent
Sep 04 2015 11:31
@guybedford ?
Guy Bedford
@guybedford
Sep 04 2015 11:33
@alexisvincent haven't considered the future workflow too deeply, but jspm will always be tied to systemjs
that is what gives us nice things like in-browser workflows in future
λex Vincent
@alexisvincent
Sep 04 2015 11:35
@guybedford I see, does implementing npm style requires make sence to you?
@guybedford Also, how will the ’next release’ change things? With reference to: “but linking workflows aren't going to be fun for development until the next release."
johnman
@johnman
Sep 04 2015 11:58
I think it's nice that jspm ties in with systemjs but I hope that systemjs doesn't change to just work well with jspm 😀 I currently have a systemjs & npm setup that works well for me and like the fact you don't have to use jspm if you don't want to
Guy Bedford
@guybedford
Sep 04 2015 12:00
@johnman systemjs's API is pretty much stable at this point apart from the module loader spec.
yes it aligns with jspm, but is specifically written to be the best solution for its own problem space
λex Vincent
@alexisvincent
Sep 04 2015 12:06
Id really like to see the option to follow npm style imports. IMO Systemjs, as I understand it, should not (while it can be biased) be exclusive to jspm style lookups.
Guy Bedford
@guybedford
Sep 04 2015 12:10
@alexisvincent there is certainly space for a project to do this, and there will likely be projects like that in future, but that is not the goal of systemjs - systemjs is about browser loading first, Node second, not vice versa
λex Vincent
@alexisvincent
Sep 04 2015 13:20

I see, but I think you misunderstand me. I mean browser loading, but resolving

import React from ‘react’

to /node_modules/react/dep/tree instead of /jspm_packages/dep/tree
I do understand that this maybe isnt a focus for you.
How would I resolve ‘react’ to /node_modules/etc without saying ‘react!npm'

@guybedford
Sean Anderson
@MeoMix
Sep 04 2015 17:58
@guybedford Thanks, that worked well.