Feature: add webpack dev server

This commit is contained in:
fecaille
2016-04-01 11:43:48 +02:00
parent 21e635f0c6
commit 9c27e23174
2 changed files with 16 additions and 6 deletions

View File

@@ -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;