Skip to content
Snippets Groups Projects
Commit 21b1ed82 authored by Yannis Barlas's avatar Yannis Barlas
Browse files

fix(*): pass client variables to build in production

parent a357ae5f
No related branches found
No related tags found
No related merge requests found
......@@ -22,11 +22,17 @@ ARG node_env
ARG server_protocol
ARG server_host
ARG server_port
ARG client_protocol
ARG client_host
ARG client_port
ENV NODE_ENV=$node_env
ENV SERVER_PROTOCOL=$server_protocol
ENV SERVER_HOST=$server_host
ENV SERVER_PORT=$server_port
ENV CLIENT_PROTOCOL=$client_protocol
ENV CLIENT_HOST=$client_host
ENV CLIENT_PORT=$client_port
RUN yarn pubsweet build
......
......@@ -11,6 +11,9 @@ services:
- server_protocol=${SERVER_PROTOCOL}
- server_host=${SERVER_HOST}
- server_port=${SERVER_PORT}
- client_protocol=${CLIENT_PROTOCOL}
- client_host=${CLIENT_HOST}
- client_port=${CLIENT_PORT}
ports:
- ${SERVER_PORT:-3000}:${SERVER_PORT:-3000}
environment:
......
......@@ -21,7 +21,7 @@ services:
- CLIENT_PORT=${CLIENT_PORT:-4000}
- SERVER_PROTOCOL=http
- SERVER_HOST=server
- SERVER_PORT=3000
- SERVER_PORT=${SERVER_PORT:-3000}
volumes:
- ./app:/home/node/app/app
- ./config:/home/node/app/config
......
......@@ -5,8 +5,8 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const CompressionPlugin = require('compression-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
.BundleAnalyzerPlugin
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
// .BundleAnalyzerPlugin
module.exports = (opts = {}) => {
const plugins = []
......@@ -38,9 +38,15 @@ module.exports = (opts = {}) => {
}
plugins.push(
new webpack.DefinePlugin({
'process.env.NODE_ENV': `"${opts.env}"`,
}),
new webpack.EnvironmentPlugin([
'NODE_ENV',
'SERVER_PROTOCOL',
'SERVER_HOST',
'SERVER_PORT',
'CLIENT_PROTOCOL',
'CLIENT_HOST',
'CLIENT_PORT',
]),
)
// put dynamically required modules into the build
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment