请教新版的CCC,按照论坛CocosCreator + SocketlO,写的测试代码,然后报错
Compile error: Cannot require ‘socket.io’, module not found, please remove file extension and retry. ( just “require(‘socket’);”
测试代码如下:
let self = this;
if(cc.sys.isNative){
window.io = SocketIO;
}else{
require('socket.io');
}
var socket = io('http://localhost:3000');
socket.on('connected',function(msg){
self.label.string = msg;
});
请教大佬解惑!