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

Commit

Permalink
fix(webpack): get INSPECT_ENABLED from process.env
Browse files Browse the repository at this point in the history
fix(webpack): get INSPECT_ENABLED from process.env
  • Loading branch information
Metnew committed Feb 19, 2018
1 parent 137c964 commit 88fded3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 3 additions & 1 deletion webpack_config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const {
ANALYZE_BUNDLE,
SENTRY_DSN,
PORT = 3000,
HOST = 'localhost'
HOST = 'localhost',
INSPECT_ENABLED = true
} = process.env

// Paths
Expand Down Expand Up @@ -41,6 +42,7 @@ export default {
SENTRY_DSN,
PORT,
HOST,
INSPECT_ENABLED,
// Client's webpack-dev-server port
DEV_SERVER_PORT,
// Paths
Expand Down
4 changes: 0 additions & 4 deletions webpack_config/devServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ import client from './client/webpack.dev.babel'
import server from './server/webpack.dev.babel'

const {DEV_SERVER_PORT} = config
if (process.argv.includes('--inspect')) {
process.env.INSPECT_ENABLED = true
}

const serverCompiler = compile(server)

// Start our server webpack instance in watch mode.
Expand Down
6 changes: 4 additions & 2 deletions webpack_config/server/webpack.dev.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import StartServerPlugin from 'start-server-webpack-plugin'
import webpack from 'webpack'
import config from '../config'

const {CLIENT_ASSETS_MANIFEST} = config
const {CLIENT_ASSETS_MANIFEST, INSPECT_ENABLED} = config
const inspectEnabled = INSPECT_ENABLED ? ['--inspect'] : []
const nodeArgs = ['-r', 'source-map-support/register', ...inspectEnabled]
const plugins = [
new webpack.HotModuleReplacementPlugin(),
new StartServerPlugin({
name: 'index.js',
nodeArgs: process.env.INSPECT_ENABLED ? ['--inspect'] : []
nodeArgs
}),
// Ignore assets.json to avoid infinite recompile bug
new webpack.WatchIgnorePlugin([CLIENT_ASSETS_MANIFEST])
Expand Down

0 comments on commit 88fded3

Please sign in to comment.