How do I import the standalone socket.io client? I'm using system.js as the module loader and I write my code in typescript.
In my typescript file I have the following import statement.
import * as io from 'socket.io-client';
The configuration of system.js looks like this.
System.config({
map: {
rxjs: 'node_modules/rxjs',
'socket.io-client': 'node_modules/socket.io-client'
},
packages: {
app: {
format: 'register',
defaultExtension: 'js'
},
rxjs: {defaultExtension: 'js'},
'socket.io-client': {defaultExtension: 'js'}
}
});
System.import('app/main')
.then(null, console.error.bind(console));
In my browser I get this error.
angular2-polyfills.js:126 GET http://localhost:3000/node_modules/socket.io-client/ 404 (Not Found)
What do I have to do to load this module?
Try to specify a full path to socket.io.js like below
System.config({
map: {
rxjs: 'node_modules/rxjs',
'socket.io-client': 'node_modules/socket.io-client/socket.io.js'
},
...