hedera-web/webpack.config.js

54 lines
1.1 KiB
JavaScript

var webpack = require ('webpack');
var path = require ('path');
var devMode = process.env.NODE_ENV !== 'production';
var config = {
entry: ['./app.js'],
output: {
path: path.join (__dirname, 'build'),
filename: 'hedera-web.js',
chunkFilename: 'chunk.[id].[chunkhash].js',
publicPath: 'build/'
},
module: {
loaders: [
{ test: /\.css$/, loader: 'style!css' },
{ test: /\.json$/, loader: 'json' },
{ test: /\.xml$/, loader: 'raw' },
{ test: /\.ttf$/, loader: 'file' }
]
},
resolve: {
modulesDirectories: [__dirname +'/js', __dirname, 'node_modules'],
fallback: process.env.NODE_PATH,
},
resolveLoader: {
fallback: process.env.NODE_PATH
},
plugins: [
new webpack.DefinePlugin ({ _DEV_MODE: devMode })
],
devServer: {
inline: true,
host: '0.0.0.0',
headers: { "Access-Control-Allow-Origin": "*" }
},
devtool: 'eval-source-map'
};
if (!devMode)
{
config.plugins.push (
new webpack.optimize.UglifyJsPlugin ({
minimize: true,
compress: { warnings: false }
})
);
config.devtool = 'source-map';
}
module.exports = config;