papiro
papiro

Reputation: 2365

System.import loading module but not executing any code within it

I've got a file named index.js which looks like this:

import Backbone from 'backbone'
import _ from 'underscore'
import $ from 'jquery'

console.log("blah")
export default {...}

In my index.html I've got:

<script>
  System.import('index');
</script>

But what's baffling me is that I can see the file being loaded (in the dev tools network panel) but the console.log is never run. If this is the case, how am I to bootstrap my application?

Several online tutorials suggest bootstrapping it in the System.import file but how can that be done if the code isn't executed?

Upvotes: 2

Views: 970

Answers (1)

papiro
papiro

Reputation: 2365

I ended up adding a .then() to the System.import with three anonymous functions, all with just a debugger and found that the import $ from 'jquery' was timing out because I didn't have the library installed. I removed the import declaration and the app was still trying to load jquery, so I installed it and it fixed the issue.

Upvotes: 1

Related Questions