Cannot use the client with webpack, because require.main.filename inmsb_client.js is not supported: Look at Issue #3244 on webpack.
App threw an error during load
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
at validateString (internal/validators.js:105:11)
at Object.dirname (path.js:580:5)
at Object../node_modules/@vfk_research/msb-client-websocket-nodejs/src/msb_client.js
// disables hostname verification for ssl (default = false).
msbClient.disableHostnameVerification(true)
// get the self desctiption to see all added configs, events and functions so far
console.info(JSON.stringify(msbClient.getSelfDescription(), null, 4))
// connect to the MSB websocket interface, if you call the .connect function without any
// parameters, the standard values from the application.properties file will be used.
msbClient.connect(msbUrl)
4. Call the msb in `/src/main/main.ts` for example:
```js
import { initMsb } from './msb/msb'
// hidden code
app.on('ready', () => {
createWindow()
initMsb()
})
// rest of the code
MSB client version: 1.0.5
MSB server version: x.y.z-RELEASE
Anything else:
My solution:
Just adding || '.' as fallback to current directory at following lines: 61, 66, 96 solves this issue. Look at this file change at node-php-fpm
I'm submitting a ...
Current behavior:
Cannot use the client with webpack, because
require.main.filename
inmsb_client.js
is not supported: Look at Issue #3244 on webpack.Expected behavior:
Should do the job on webpack as well!?!
Steps to reproduce:
const uuid = '' const name = '' const description = '' const token = '' const type = 'Application' const msbUrl = '***'
const msbClient = new MsbClient(type, uuid, name, description, token)
export const initMsb = () => { // enable debug log messages (default = false). msbClient.enableDebug(true)
// enable data format and message data validation (default = false) // might impact performance msbClient.enableDataFormatValidation(true)
// enable auto reconnect for the client (default = false). msbClient.disableAutoReconnect(false)
// set the reconnect interval time (default = 10000 ms). msbClient.setReconnectInterval(10000)
// enable event message cache which stores messages in case of a connection loss (default = true). msbClient.disableEventCache(true)
// set event cache size (default = 1000 message events). msbClient.setEventCacheSize(1000)
// disables hostname verification for ssl (default = false). msbClient.disableHostnameVerification(true)
// get the self desctiption to see all added configs, events and functions so far console.info(JSON.stringify(msbClient.getSelfDescription(), null, 4))
// connect to the MSB websocket interface, if you call the .connect function without any // parameters, the standard values from the application.properties file will be used. msbClient.connect(msbUrl)
// register client on MSB msbClient.register() }
export const closeMsb = () => { msbClient.disconnect() }
export default msbClient
MSB client version: 1.0.5
MSB server version: x.y.z-RELEASE
Anything else:
My solution:
Just adding
|| '.'
as fallback to current directory at following lines: 61, 66, 96 solves this issue. Look at this file change at node-php-fpm