If I have lib, say utils.js , which looks like
exports.foo = function () { return 'foo'; }; exports.bar = function () { return 'bar'; };
What can be used as follows
import {foo} from './libs/utils'; console.log(foo());
Not very impressive, but I feel that this problem is causing the problem described in this publication. In any case, I cannot get this to work in conjunction with SystemJS . I need to change the code to fix it.
import utils from './libs/utils'; console.log(utils.foo());
Here is my systemjs-config file:
SystemJS.config({ map: { 'plugin-babel': 'node_modules/systemjs-plugin-babel/plugin-babel.js', 'systemjs-babel-build': 'node_modules/systemjs-plugin-babel/systemjs-babel-browser.js', }, packages: { '.': { defaultJSExtensions: 'js' } }, transpiler: 'plugin-babel' });
Thus, only an exports object can be loaded, not a named export. Could this be fixed somehow?
UPDATE I get the impression that it can be fixed using formats
meta: { './libs/utils.js': { format: 'cjs' } }
But for now it gives the same problems