These are chat archives for systemjs/systemjs

8th
Apr 2019
Denis Lantsman
@dlants
Apr 08 16:02

Hey folks! I'm quite confused with getting systemjs2 working. I set up the loader, created a systemjs-packagemap, and tried to load my index file... I get SyntaxError: import declarations may only appear at top level of a module in Firefox, and Unexpected token: { in chrome. It seems that it's not able to parse my import {stuff} from 'module' statement, which is in es2015 syntax.

Am I misunderstanding that es module loading should work out of the box?

Tundon
@Tundon
Apr 08 16:05
Systemjs is not for loading ES modules, it is designed to load SystemJS modules (which you can think of as transpired ES modules in ES 5 standards)
You will have to use ‘System.import(...)’ to load your systemjs module
Denis Lantsman
@dlants
Apr 08 16:06
This line in the readme:
The minimal 1.5KB s.js loader provides a workflow where code written for production workflows of native ES modules in browsers (like Rollup code-splitting builds), can be transpiled to the System.register module format to work in older browsers that don't supporting native modules, including IE11++.
made me believe that system would handle transpiling from native to system modules
Tundon
@Tundon
Apr 08 16:07
If you wish to do so, there is a systemjs transform extension available
Denis Lantsman
@dlants
Apr 08 16:08
ok, so that sentence is basically saying: if you have es modules, you can (yourself) transpile them into the system format, and then load them with systemjs. And, there's a systemjs extension that can do this on-the-fly in the browser?
Tundon
@Tundon
Apr 08 16:10
Yep, that is correct
At least my understanding
Denis Lantsman
@dlants
Apr 08 16:10
@Tundon, just to double check, this is systemjs2.0, 0.21 or both?
Tundon
@Tundon
Apr 08 16:11
2.0, that’s what I used
0.21 I used jspm, which handles the transpile part for me
so that says "in older browsers" which again makes me believe that the current version should work with native es modules without it
@Tundon do you have a link to the extension you're using or any docs/example setups that I could follow along with?
Denis Lantsman
@dlants
Apr 08 16:17
ok, cool. I'll try that. Thanks!
Denis Lantsman
@dlants
Apr 08 16:33
@Tundon do you have your project setup visible anywhere? I'm running into issues with systemjs-packagemap now :(
Tundon
@Tundon
Apr 08 16:35
Nah, I just did some experiments, didn’t have any repo > <
Denis Lantsman
@dlants
Apr 08 16:38
I think I'm going to give up on using systemjs2 directly and try jspm :)