2016-09-24 14:32:31 +00:00
|
|
|
|
|
|
|
var webpack = require ('webpack');
|
2016-09-27 19:31:46 +00:00
|
|
|
var path = require ('path');
|
|
|
|
|
2016-10-14 10:58:35 +00:00
|
|
|
var devMode = process.env.NODE_ENV !== 'production';
|
2016-09-24 14:32:31 +00:00
|
|
|
|
2016-12-05 12:39:29 +00:00
|
|
|
var config = {
|
2016-10-04 15:27:49 +00:00
|
|
|
entry: ['./app.js'],
|
|
|
|
output: {
|
2016-09-27 19:31:46 +00:00
|
|
|
path: path.join (__dirname, 'build'),
|
|
|
|
filename: 'hedera-web.js',
|
2016-10-21 08:44:53 +00:00
|
|
|
chunkFilename: 'chunk.[id].[chunkhash].js',
|
2016-10-30 22:48:18 +00:00
|
|
|
publicPath: 'build/'
|
2016-10-04 15:27:49 +00:00
|
|
|
},
|
|
|
|
module: {
|
2017-04-24 08:06:50 +00:00
|
|
|
rules: [
|
|
|
|
{ test: /\.css$/, loader: 'style-loader!css-loader' },
|
|
|
|
{ test: /\.json$/, loader: 'json-loader' },
|
|
|
|
{ test: /\.xml$/, loader: 'raw-loader' },
|
|
|
|
{ test: /\.ttf$/, loader: 'file-loader' }
|
2016-09-26 09:28:47 +00:00
|
|
|
]
|
2016-10-04 15:27:49 +00:00
|
|
|
},
|
|
|
|
resolve: {
|
2017-04-24 08:06:50 +00:00
|
|
|
modules: [
|
|
|
|
__dirname +'/js',
|
|
|
|
__dirname,
|
|
|
|
'node_modules',
|
|
|
|
'/usr/lib/node_modules'
|
|
|
|
]
|
2016-10-04 15:27:49 +00:00
|
|
|
},
|
2016-09-26 09:28:47 +00:00
|
|
|
plugins: [
|
2016-11-07 22:26:28 +00:00
|
|
|
new webpack.DefinePlugin ({ _DEV_MODE: devMode })
|
2016-10-11 14:45:10 +00:00
|
|
|
],
|
2016-10-30 22:48:18 +00:00
|
|
|
devServer: {
|
|
|
|
inline: true,
|
|
|
|
host: '0.0.0.0',
|
2017-04-27 08:27:39 +00:00
|
|
|
port: '9000',
|
2016-10-30 22:48:18 +00:00
|
|
|
headers: { "Access-Control-Allow-Origin": "*" }
|
2016-11-07 22:26:28 +00:00
|
|
|
},
|
|
|
|
devtool: 'eval-source-map'
|
2016-09-24 14:32:31 +00:00
|
|
|
};
|
2016-09-27 19:31:46 +00:00
|
|
|
|
2016-11-07 22:26:28 +00:00
|
|
|
if (!devMode)
|
|
|
|
{
|
|
|
|
config.plugins.push (
|
|
|
|
new webpack.optimize.UglifyJsPlugin ({
|
|
|
|
minimize: true,
|
|
|
|
compress: { warnings: false }
|
|
|
|
})
|
|
|
|
);
|
|
|
|
config.devtool = 'source-map';
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = config;
|
|
|
|
|