These are chat archives for systemjs/systemjs

Jul 2016
Abhisek Pattnaik
Jul 19 2016 14:22

:question: :raising_hand: How do I specify the babelOptions for es2016 and stage-0 presets?

Abhisek Pattnaik
Jul 19 2016 14:27
I've specified them as
    main: 'index.js',
    depCache: {
        'lodash/fp': ['lodash']
    babelOptions: {
        'stage-0': true,
        es2016: true,
        // presets: ['es2016', 'stage-0'],
        sourceMaps: true
    bundles: {
        'babel-bundle': ['plugin-babel', 'systemjs-babel-build']
    map: {
        'plugin-babel': './bower_components/plugin-babel/plugin-babel.js',
        'systemjs-babel-build': './bower_components/plugin-babel/systemjs-babel-browser.js',
    transpiler: 'plugin-babel'
I'm not sure if it works :expressionless:
Abhisek Pattnaik
Jul 19 2016 14:42
Why do I get this weird error?
system.js:4 Uncaught (in promise) Error: (SystemJS) Error: XHR error (404 Not Found) loading http://localhost:3000/js/helpers
    Error loading http://localhost:3000/js/helpers as "./helpers" from http://localhost:3000/js/index.js
// js/helpers/index.js

export { alert } from './alert'
// js/index.js

import { alert } from './helpers'
I've defaultJSExtensions: true set (altho not required in new versions)
i've main: 'index.js' too
Jul 19 2016 18:07
I'm trying to get Systemjs to load some stuff in a particular order System.import('') .then((jq) => { console.log(1); console.log($.fn.dataTable); console.log(1.1); console.log($.fn.dataTable.render); return System.import('DataTables-Plugins/dataRender/ellipsis.js') .then(() => { console.log(2); }) }) .then(s => { console.log(3); console.log($.fn.dataTable.render.ellipsis); return true; }); does that not work?
Abhisek Pattnaik
Jul 19 2016 22:33

:question: :raising_hand: How do I make some variables global?

I tried this
meta: {

    'lodash/fp': {
      deps: ['lodash']
    lodash: {
      format: 'global',
      exports: '_'
    sweetalert2: {
      format: 'global',
      exports: 'swal'
  map: {
    'plugin-babel': './bower_components/plugin-babel/plugin-babel.js',
    'systemjs-babel-build': './bower_components/plugin-babel/systemjs-babel-browser.js',
    lodash: './bower_components/lodash/dist/lodash.min.js',
    'lodash/fp': './bower_components/lodash/dist/lodash.fp.min.js',
    sweetalert2: './bower_components/sweetalert2/dist/sweetalert2.min.js'
I want _ to be global lodash
and also want fp = _.noConflict() to be global too
// lodash.js

import _ from 'lodash'
const fp =  _.noConflict()
export {_, fp}
// globals.js

export {_, fp} from './lodash.js'

window.fp = fp
And also I've to append the extension i.e. .js while loading ES6 modules
If I try it without extension, I get the following error
system.js:4 Uncaught (in promise) Error: (SystemJS) Error: XHR error (404 Not Found) loading http://localhost:3000/js/helpers/lodash(…)
Michael Bøcker-Larsen
Jul 19 2016 23:57
If you remove the exports part I believe system js will make whatever global that's global "in there".
Not that it is an answer to your question but here is a config that I use in a project. @abhisekp