May 16, 2019
0
Level 2
Getting Object in the place of ENV var at build time.
Hello. This is part of the code of the js file which is being compiled.
window.Echo = new Echo({
broadcaster: 'socket.io',
host: window.location.hostname + ':' + process.env.MIX_BROADCAST_PORT
});
The issue is that if this MIX_BROADCAST_PORT var is not defined the compiled code is like this.
window.Echo = new __WEBPACK_IMPORTED_MODULE_0_laravel_echo___default.a({
broadcaster: 'socket.io',
host: window.location.hostname + ':' + Object({"NODE_ENV":"development"}).MIX_BROADCAST_PORT
});
If I define that ENV var even without a value. The code compiles fine ending up like this.
window.Echo = new __WEBPACK_IMPORTED_MODULE_0_laravel_echo___default.a({
broadcaster: 'socket.io',
host: window.location.hostname + ':'});
What is the catch here? =)
Please or to participate in this conversation.