These are chat archives for systemjs/systemjs

7th
May 2015
Mike Haas
@mikehaas763
May 07 2015 14:17
Any idea why in the example below, when doing import AngularWizard from 'angular-wizard'; lodash is not loaded? If I directly do an import 'lodash' though I can see it is being loaded.
System.config({
  map: {'angular-wizard': 'GlobalsAdapters/AngularWizard',
    'lodash': 'node_modules/lodash/index'
  }
});
System.meta['GlobalsAdapters/AngularWizard'] = { deps: ['lodash'] };
System.import('ClientCenter/bootstrap');
Guy Bedford
@guybedford
May 07 2015 16:02
metadata deps work for all module formats except for ES6 unfortunately
Eric Eastwood
@MadLittleMods
May 07 2015 16:02
I am trying to write a custom postcss plugin but I can't get it to load in. When trying to use import 'somestyles.css!mypostcss'; and mypostcss.js is in the root of the project for simplicity. If nothing is added to the map then I get Error loading "somecss.css!mypostcss" at <unknown>. If I do "mypostcss": "mypostcss", in the config.js map, it just removes the entry from the config and I get the same error.
If I do "mypostcss": "mypostcss.js", in the config.js map, it tries to load /mypostcss.js.js
Guy Bedford
@guybedford
May 07 2015 16:02
@mikehaas763 so if GlobalsAdapters/AngularWizard is ES6 that would explain it
Mike Haas
@mikehaas763
May 07 2015 16:03
@guybedford :frowning:
it is
Guy Bedford
@guybedford
May 07 2015 16:03
it's a limitation of the spec unfortunately, a work around would be to use the alias module feature
(coming in the next version)
for now, perhaps just create a custom wrapper module
@MadLittleMods having it in the baseURL folder should work fine
Mike Haas
@mikehaas763
May 07 2015 16:04
I just ended up loading lodash globally from the dom. I have other global deps that expect lodash to be available globally so I can't just wrap it in this case.
Guy Bedford
@guybedford
May 07 2015 16:04
make sure you provide some export / hook
@mikehaas763 you should shim all anything that expects lodash
always good to make the tree explicit
Mike Haas
@mikehaas763
May 07 2015 16:06
@guybedford I would have but I couldn't shim a certain global script because of some of the limitations of shims we discussed yesterday
Eric Eastwood
@MadLittleMods
May 07 2015 16:19
It seems my paths are getting mangled in the plugin. I am trying to import a mixin via import cursorHandMixin from './postcss-mixins/cursor-hand'; and the plugin is at the root. It tries to load Error loading "npm:postcss-mixins@0.1.1/cursor-hand" at http://localhost/jspm_packages/npm/postcss-mixins@0.1.1/cursor-hand.js
I do have a postcss-mixins package installed as well though but there is also that directory in the root does exists with the mixins
Eric Eastwood
@MadLittleMods
May 07 2015 16:24
Renamed the folder to ./custom-postcss-mixins and it does seem to go through
Eric Eastwood
@MadLittleMods
May 07 2015 16:41
Am I doing something wrong with this plugin? I am using a promise in the translate hook. I am adding 'module.exports = ' to the load.source because other plugins like !text and !json do it.
This plugin is always throwing a Uncaught SyntaxError: Unexpected token { pointing to the CSS file imported. It does console.log Success though
Eric Eastwood
@MadLittleMods
May 07 2015 16:47
Resolving an empty string allows it go through and now I suspect I should somehow pipe it through plugin-css so that it can work its magic and add it to the dom
Eric Eastwood
@MadLittleMods
May 07 2015 17:04
Okay I got this working basing it off of geelen's gists: https://github.com/systemjs/plugin-css/issues/22#issuecomment-89491851
Updated gist
Trying to import autoprefixer-core gives a whole bunch GET errors about caniuse-db js files
Eric Eastwood
@MadLittleMods
May 07 2015 17:57
@guybedford In node you can require .json files just like .js. I am running into an issue with the autoprefixer-core package because it requires in those .json files from its dependency caniuse-db package and SystemJS tries to grab a .js and the GET request fails.
Installing jspm install json doesn't solve the issue because there are not bangs on the end
Should I create a issue for this?
Here is the commit in node that allows the .json extension require: joyent/node@588d885 - Looks like it came in v0.5.x
Eric Eastwood
@MadLittleMods
May 07 2015 18:24
Ahh, looks like an issue has been made about the same package: systemjs/systemjs#388