Skip to content
This repository has been archived by the owner on Jan 1, 2024. It is now read-only.

Commit

Permalink
fix(webpack_config): GA_ID/sentr to global conf, add BASE_API_SSR var
Browse files Browse the repository at this point in the history
fix(webpack_config): GA_ID/public sentry to global conf, add
BASE_API_SSR var
  • Loading branch information
Metnew committed Dec 5, 2017
1 parent 00ff85c commit c836e7c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
6 changes: 2 additions & 4 deletions webpack_config/client/webpack.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ import AssetsPlugin from 'assets-webpack-plugin'
import FaviconsWebpackPlugin from 'favicons-webpack-plugin'
import WebpackAssetsManifest from 'webpack-assets-manifest'
const {
GA_ID,
SENTRY_PUBLIC_DSN,
CLIENT_DIST_PATH,
BASE_API,
rootPath,
srcPath,
publicPath,
Expand All @@ -21,8 +20,7 @@ const {
rimraf(`${config.distPath}/client`, {}, () => {})

const definePluginArgs = {
'process.env.GA_ID': JSON.stringify(GA_ID),
'process.env.SENTRY_PUBLIC_DSN': JSON.stringify(SENTRY_PUBLIC_DSN),
'process.env.BASE_API': JSON.stringify(BASE_API),
'process.env.BROWSER': JSON.stringify(true)
}

Expand Down
2 changes: 2 additions & 0 deletions webpack_config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ export default {
isProduction,
// Env vars
BASE_API,
API_PREFIX: BASE_API,
BASE_API_SSR: `http://localhost:${PORT}${BASE_API}`,
NODE_ENV,
SENTRY_PUBLIC_DSN,
ANALYZE_BUNDLE,
Expand Down
7 changes: 5 additions & 2 deletions webpack_config/server/webpack.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import webpack from 'webpack'
import rimraf from 'rimraf'
import config from '../config'
import isomorphicWebpackConfig from '../webpack.isomorphic'
const {SENTRY_DSN, CLIENT_DIST_PATH, JWT_SECRET, PORT, isProduction} = config
const {SENTRY_DSN, CLIENT_DIST_PATH, JWT_SECRET, PORT, publicPath, BASE_API_SSR, API_PREFIX, isProduction} = config

// Clear dist dir before run
rimraf(`${config.distPath}/server`, {}, () => {})
Expand All @@ -20,7 +20,9 @@ const definePluginArgs = {
'process.env.PORT': JSON.stringify(PORT),
'process.env.JWT_SECRET': JSON.stringify(JWT_SECRET),
'process.env.SENTRY_DSN': JSON.stringify(SENTRY_DSN),
'process.env.CLIENT_DIST_PATH': JSON.stringify(CLIENT_DIST_PATH)
'process.env.CLIENT_DIST_PATH': JSON.stringify(CLIENT_DIST_PATH),
'process.env.BASE_API': JSON.stringify(BASE_API_SSR),
'process.env.API_PREFIX': JSON.stringify(API_PREFIX)
}

let nodeModules = {}
Expand All @@ -42,6 +44,7 @@ const baseWebpackConfig = {
path: path.join(config.distPath, './server'),
filename: 'index.js',
chunkFilename,
publicPath,
libraryTarget: 'commonjs2'
},
externals: nodeModules,
Expand Down
5 changes: 3 additions & 2 deletions webpack_config/webpack.isomorphic.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import config from './config'
import webpack from 'webpack'
import CircularDependencyPlugin from 'circular-dependency-plugin'

const {srcPath, rootPath, srcCommonPath, BASE_API, NODE_ENV} = config
const {srcPath, rootPath, srcCommonPath, NODE_ENV, GA_ID, SENTRY_PUBLIC_DSN} = config

const definePluginArgs = {
'process.env.NODE_ENV': JSON.stringify(NODE_ENV),
'process.env.BASE_API': JSON.stringify(BASE_API)
'process.env.GA_ID': JSON.stringify(GA_ID),
'process.env.SENTRY_PUBLIC_DSN': JSON.stringify(SENTRY_PUBLIC_DSN)
}

export default {
Expand Down

0 comments on commit c836e7c

Please sign in to comment.