diff --git a/apps/block_scout_web/assets/js/socket.js b/apps/block_scout_web/assets/js/socket.js index 3490157a8b..ef0846220b 100644 --- a/apps/block_scout_web/assets/js/socket.js +++ b/apps/block_scout_web/assets/js/socket.js @@ -1,7 +1,7 @@ import { Socket } from 'phoenix' import { locale } from './locale' -const socket = new Socket('/socket', { params: { locale: locale } }) +const socket = new Socket(process.env.SOCKET_ROOT + '/socket', { params: { locale: locale } }) socket.connect() export default socket diff --git a/apps/block_scout_web/assets/webpack.config.js b/apps/block_scout_web/assets/webpack.config.js index 07452b55c8..76abc70bee 100644 --- a/apps/block_scout_web/assets/webpack.config.js +++ b/apps/block_scout_web/assets/webpack.config.js @@ -5,6 +5,7 @@ const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin') const CopyWebpackPlugin = require('copy-webpack-plugin') const { ContextReplacementPlugin } = require('webpack') const glob = require('glob') +const webpack = require('webpack') function transpileViewScript(file) { return { @@ -136,7 +137,10 @@ const appJs = filename: '../css/[name].css' }), new CopyWebpackPlugin([{ from: 'static/', to: '../' }]), - new ContextReplacementPlugin(/moment[\/\\]locale$/, /en/) + new ContextReplacementPlugin(/moment[\/\\]locale$/, /en/), + new webpack.DefinePlugin({ + 'process.env.SOCKET_ROOT': JSON.stringify(process.env.SOCKET_ROOT || '') + }) ] }