These are chat archives for systemjs/systemjs

19th
Jul 2015
PeterKnight
@PeterKnight
Jul 19 2015 19:25
Having a workflow issue with bundles. I have system.js running on the page, I have my-bundled-script.js (bundled with jspm) but how do I make it so that system.js doesn't load all my es6 modules separately?
Micah Zoltu
@MicahZoltu
Jul 19 2015 19:26
@PeterKnight Did you remember to include the bundle in a script tag in the page before doing your first import?
PeterKnight
@PeterKnight
Jul 19 2015 19:30
Yes, the script tag is there before the import should happen
Micah Zoltu
@MicahZoltu
Jul 19 2015 19:31
And the symptom is that the browser is still fetching all of the files from the server? What does your bundle command look like?
PeterKnight
@PeterKnight
Jul 19 2015 19:32
yes... jspm bundle main.js main-bundle.js
I must be doing something elementary wrong
Micah Zoltu
@MicahZoltu
Jul 19 2015 19:32
Is the browser fetching main.js?
PeterKnight
@PeterKnight
Jul 19 2015 19:33
yes
Micah Zoltu
@MicahZoltu
Jul 19 2015 19:34
Can you show what your script tags look like (in order)?
Do you see the browser fetching main-bundle.js?
PeterKnight
@PeterKnight
Jul 19 2015 19:34
main-bundle.js is included with script tag so that's loaded before
Micah Zoltu
@MicahZoltu
Jul 19 2015 19:36
Is main-bundle.js before or after your script tag for system.js?
PeterKnight
@PeterKnight
Jul 19 2015 19:37
system.js is included first then main-bundle.js and then the import code
Micah Zoltu
@MicahZoltu
Jul 19 2015 19:38
What does the import look like?
PeterKnight
@PeterKnight
Jul 19 2015 19:39
System.import('main');
Micah Zoltu
@MicahZoltu
Jul 19 2015 19:39
Try (for kicks) jspm bundle main main-bundle.js
(without the .js suffix)
So it matches your import.
(this shouldn't matter)
PeterKnight
@PeterKnight
Jul 19 2015 19:39
trying!
Micah Zoltu
@MicahZoltu
Jul 19 2015 19:40
If you open up your main-bundle.js, you should see a System.register call. What is the first parameter? Is it main.js?
PeterKnight
@PeterKnight
Jul 19 2015 19:41
the first System.register call in the bundle starts with a module file
hmm
Micah Zoltu
@MicahZoltu
Jul 19 2015 19:42
Do you see a System.register call for main.js anywhere in your bundle?
PeterKnight
@PeterKnight
Jul 19 2015 19:43
at the end yes
Micah Zoltu
@MicahZoltu
Jul 19 2015 19:44
Try putting a breakpoint on your call to System.import('main'). Once broken, you shouldn't see main.js fetched from the server yet.
Step over and see if you see main.js being fetched.
PeterKnight
@PeterKnight
Jul 19 2015 19:48
You've helped me figure it out I believe. I'm working with a second instance of System, but the bundle registers on the first...stupid me
thank you Zoltu
Micah Zoltu
@MicahZoltu
Jul 19 2015 19:50
No problem.
Glad you figured it out, because I was out of ideas. :)
PeterKnight
@PeterKnight
Jul 19 2015 19:52
:D