Is it possible to use this library with webpack?
I have an error wile importing lib like this in angular 9 project import * as io from 'socketio-shared-webworker'; or const wio = require('socketio-shared-webworker');
Module parse failed: Unexpected token (9:15)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| class SharedWorkerSocketIO {
|
> WorkerType = global.SharedWorker || global.Worker
| worker = null
| workerUri = null
i 「wdm」: Failed to compile.
Same problem too! Any idea?
hi, this problem is caused by exporting /src/ instead of /dist/ library, which is using ES7 syntax. edit index.js change './src/socket.io-worker' to './dist/socket.io-worker' will solve this problem
require('socketio-shared-webworker') // returns {} idk y
const io = global.wio
Hi there!
I'm afraid I'm not quite understanding how to use this library with ES6 syntax; would anyone happen to have an example using import?
I've tried a few variations of the below, but I can't seem to make anything stick
import * as wio from 'socketio-shared-webworker/dist/socket.io-worker';
You can use this with babel but you'll need to enable the babel plugin https://babeljs.io/docs/en/babel-plugin-proposal-class-properties
Here is the .babelrc file used by the project:
{
"presets": ["@babel/preset-env"],
"plugins": ["@babel/plugin-proposal-class-properties"]
}
How can I use it in the next.js project... TypeError: socketio_shared_webworker__WEBPACK_IMPORTED_MODULE_2___default(...) is not a function