Reputation: 16748
I'm doing this in my application
System.import('lib/bootstrap.js').then(m => {
this.socket = m.io("http://localhost:3000");
})
This is bootstrap.js
import io from 'socket.io-client';
export { io };
I created a bundle via jspm bundle lib/bootstrap.js outfile.js
.
When I try to System.import('outfile.js')
the resolved Promise m
is only an empty Object.
What am I doing wrong here?
System.import('outfile.js').then(m => {
this.socket = m.io("http://localhost:3000");
})
Upvotes: 0
Views: 190
Reputation: 1050
You don't want to import the bundled file. What you need to do is inject the bundle configuration to your config.js file. For example adding jspm bundle lib/bootstrap bootstrap-bundle.js --inject
will add
"bundles": {
"bootstrap-bundle": [
"socket.io-client.js",
"lib/bootstrap.js"
]
}
to your config.js file. Then you just need to import your file as usual:
System.import('lib/bootstrap.js').then(m => {
this.socket = m.io("http://localhost:3000");
})
See the documentation here.
Upvotes: 1