im getting this error on the console web browser:
ReferenceError: module is not defined
this is my code
import * as socketio from 'socket.io-client'
this.socket = socketio.connect('http://localhost:3000');
this.socket.on('connect', (socket) => {
console.log('connected');
});
im getting this errors too
rollup v1.29.0
bundles ./src/game.ts → dist\game.js…
(!) Unresolved dependencies
socket.io-client (imported by src\scenes\menu.ts)
(!) Missing global variable name
Use output.globals to specify browser global variable names corresponding to external modules
socket.io-client (guessing ‘socketio’)
created dist\game.js in 5.4s
// We need to convert the Phaser 3 CJS modules into a format Rollup can use:
commonjs({
include: [
'node_modules/eventemitter3/**',
'node_modules/phaser/**',
'node_modules/socket.io-client/**'
],
exclude: [
'node_modules/phaser/src/polyfills/requestAnimationFrame.js'
],
sourceMap: true,
ignoreGlobal: true
}),
the unresolved dependecies should be solved with?
'node_modules/socket.io-client/'
i dont know why dont let me import like this:
import io from 'socket.io-client'
im getting this error:
Module ‘“socket.io-client”’ can only be default-imported using the ‘esModuleInterop’ flagts(1259)
index.d.ts(9, 5): This module is declared with using ‘export =’, and can only be used with a default import when using the ‘esModuleInterop’ flag.
How should i import the module?
Someone know wich is the problem? some hint? is the rollup the problem?
thx