move socket path to env

pull/2955/head
Max Alekseenko 5 years ago
parent 130a4084ea
commit bd589433fc
  1. 2
      apps/block_scout_web/assets/js/socket.js
  2. 6
      apps/block_scout_web/assets/webpack.config.js

@ -1,7 +1,7 @@
import { Socket } from 'phoenix' import { Socket } from 'phoenix'
import { locale } from './locale' 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() socket.connect()
export default socket export default socket

@ -5,6 +5,7 @@ const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin') const CopyWebpackPlugin = require('copy-webpack-plugin')
const { ContextReplacementPlugin } = require('webpack') const { ContextReplacementPlugin } = require('webpack')
const glob = require('glob') const glob = require('glob')
const webpack = require('webpack')
function transpileViewScript(file) { function transpileViewScript(file) {
return { return {
@ -136,7 +137,10 @@ const appJs =
filename: '../css/[name].css' filename: '../css/[name].css'
}), }),
new CopyWebpackPlugin([{ from: 'static/', to: '../' }]), 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 || '')
})
] ]
} }

Loading…
Cancel
Save