These are chat archives for systemjs/systemjs

26th
Jan 2017
Peter Safranek
@pe8ter
Jan 26 2017 01:06
@guybedford Do I need to put my warnings: true property into its own System.config(...) call or can I put that into my existing System.config(...) call?
Peter Safranek
@pe8ter
Jan 26 2017 01:15
@guybedford I see the problem. The minified version of SystemJS (0.19.42) does not include the call to console.warn(). I switched to the non-minified version and I see the warnings now. Not sure if removing that call in the minified version is intentional.
Geza Kovacs
@gkovacs
Jan 26 2017 04:08
Is it possible to do something like SystemJS.import(), but supply the text contents of the module instead of the path? (context: I am attempting to load some code that uses commonJS-style exports, which are stored in the browser's indexeddb storage rather than the filesystem)
Ricky Blankenaufulland
@ZoolWay
Jan 26 2017 06:11
@gkovacs Should be possible with System.set/System.newModule
Geza Kovacs
@gkovacs
Jan 26 2017 06:30
@ZoolWay thanks I know about System.newModule, but what about the "parsing commonJS code into a module" step? ie, how can I go from a string 'module.exports.foo = function() {return 3}' to the {foo: function() {return 3}} object?
Ricky Blankenaufulland
@ZoolWay
Jan 26 2017 06:32
@gkovacs I am not an expert on this, but basically I have seen this text plugin registered by the aurelia framework: it takes the loaded source code (here just text) and wraps it with string operations into a module to load so I can access the text as a string as far as I understand: https://github.com/aurelia/loader-default/blob/master/src/index.js#L188-L201
Geza Kovacs
@gkovacs
Jan 26 2017 06:55
@ZoolWay I looked at that code, it's just exporting a module that has module.exports set to the input string.
I'm looking for the part of SystemJS that actually parses and evaluates CommonJS code
ie input is something like 'module.exports.foo = function() {return 3}' and output is the exports object, ie {foo: function() {return 3}}
Geza Kovacs
@gkovacs
Jan 26 2017 07:14
ah I think translateAndInstantiate in src/instantiate.js (https://github.com/systemjs/systemjs/blob/master/src/instantiate.js#L214) is what I'm looking for. sadly not part of the public API
Geza Kovacs
@gkovacs
Jan 26 2017 10:41
Actually I ended up managing to solve my own problem via registerDynamic and the Function constructor, as follows:
var somefunc = new Function('require', 'exports', 'module', 'module.exports.foo = function() {return 3}')
System.registerDynamic('foo_lib6', [], true, somefunc)
System.import('foo_lib6').then(x => console.log(x.foo))
vv7v7
@vv7v7
Jan 26 2017 11:11
Рун\
Hey
Can anyone tell me what SystemJS is used for ?
What is the main purpose of it ?
Thank you !
Gert Sønderby
@gertsonderby
Jan 26 2017 11:13
@vv7v7 It loads modules. Kind of like a browser version of node require, except it follows the developing System standard from WHATWG.
https://github.com/systemjs/systemjs/ <- Recommended reading. ;-)
x000000
@x000000
Jan 26 2017 11:24
Hi, could anyone tell me how to prevent builder from normalizing package name? normalize option works only for dependencies, but not for the package itself
Gert Sønderby
@gertsonderby
Jan 26 2017 11:46
@guybedford Tried the warning flag, got no warnings. Updated to JSPM beta.34 and SystemJS 0.20, and... now nothing works. In browser, it tries to load my entry point like it's a file. Testing (via jspm run) syntax-errors on first JSX. Clearly, something has gone awry.
But what?
It appears to ignore path definitions in my config, where a path name is changed. But only in browser - seems to work fine in CLI...
And if I change the entry point to the mapped file path, it instead vomits on first JSX. Babel apparently is not being run?
Gert Sønderby
@gertsonderby
Jan 26 2017 11:53
Apparently there were warnings I should have gotten. :-/
Guy Bedford
@guybedford
Jan 26 2017 14:29
@gertsonderby there was a bug in SystemJS where the warnings were only showing for the unminified SystemJS build. I updated SystemJS 0.19 with a patch today that makes sure the warnings still display for the minified build. Perhaps that was it?
@gertsonderby global babelOptions aren't supported anymore, and must be set via meta configuration
System.config({ babelOptions: {...} }) is deprecated for System.config({ meta: { '*': { babelOptions: {...} } } })
Radoslav Karaivanov
@rkaraivanov
Jan 26 2017 15:34
hey,
is there a change in the way systemjs transpiles typescript with the plugin-typescript?
Ricky Blankenaufulland
@ZoolWay
Jan 26 2017 16:00
hi! is chaining loader plugins supported by systemjs? the doc page about "using plugins" looks missing and I am not sure if my problems ist just about not supporting using more than one plugin...
Davis Sylvester
@DavisSylvester
Jan 26 2017 20:59
I have a custom npm package i am trying to load using systemJS.
packages: { 'tsg-web-storage' : {
main: "./dist/index.js",
defaultExtension: 'js'
}
}
do i need to do anything additional to load the module besides: paths: {
// paths serve as alias
'npm:': 'node_modules/'
},