Skip to content

Commit

Permalink
adds support to using webpack-dev-server
Browse files Browse the repository at this point in the history
this allow the developer to:
- use websockets in development env without apache
- enjoy live reload in the browser when webpack code change

to use, execute:

NODE_ENV=development ./node_modules/.bin/webpack-dev-server --config config/webpack/development.js

you may use PORT or WS_PORT to override the default 3000 PORT.
  • Loading branch information
ohadlevy committed Nov 7, 2017
1 parent 0ba4153 commit 5b4e241
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions config/webpack/development.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const merge = require('webpack-merge')
const sharedConfig = require('./shared.js')
const { settings, output } = require('./configuration.js')
const { env } = require('process')

module.exports = merge(sharedConfig, {
devtool: 'cheap-eval-source-map',
Expand All @@ -27,6 +28,19 @@ module.exports = merge(sharedConfig, {
historyApiFallback: true,
watchOptions: {
ignored: /node_modules/
},
proxy: {
'/': {
target: `http://${settings.dev_server.host}:${env.PORT || '3000'}`,
secure: false,
},
'/ws': {
target: `ws://${settings.dev_server.host}:${env.WS_PORT ||
env.PORT ||
'3000'}`,
secure: false,
ws: true,
},
}
}
})

0 comments on commit 5b4e241

Please sign in to comment.