diff --git a/package.json b/package.json index 923d28f..cde2ec6 100644 --- a/package.json +++ b/package.json @@ -28,9 +28,8 @@ "webpack-dev-server": "^1.14.1" }, "scripts": { - "dev": "webpack-dev-server --hot --inline --devtool eval --progress --colors --content-base build --port 9999", - "dev-build": "webpack -d --progress --colors", - "prod-build": "webpack -d -p --colors", - "watch": "webpack --watch -d" + "watch": "NODE_ENV=development webpack-dev-server --hot --inline", + "dev-build": "NODE_ENV=development webpack --d --progress --colors", + "prod-build": "webpack -d -p --colors" } } diff --git a/webpack.config.js b/webpack.config.js index a46217d..72995bd 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -5,7 +5,8 @@ var path = require('path'), HtmlWebpackPlugin = require('html-webpack-plugin'); var source_dir = __dirname + '/src/main/resources/static', - node_dir = __dirname + '/node_modules'; + node_dir = __dirname + '/node_modules', + dev_port = 9090; var config = { entry: { @@ -19,7 +20,7 @@ var config = { cache: true, debug: true, output: { - path: './target/classes/static', + path: __dirname + '/target/classes/static', filename: 'js/[name].bundle.js', publicPath: '/' }, @@ -33,6 +34,10 @@ var config = { hash: true }) ], + devServer: { + port: dev_port, + publicPath: 'http://localhost:' + dev_port + '/' + }, module: { loaders: [ { @@ -82,4 +87,10 @@ var config = { } }; +var env = process.env.NODE_ENV; + +if (env === 'development') { + config.output.publicPath = 'http://localhost:' + dev_port + '/'; +} + module.exports = config; \ No newline at end of file