hedera-web/webpack.config.js

56 lines
1.0 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: {
rules: [
{ test: /\.css$/, loader: 'style-loader!css-loader' },
{ test: /\.json$/, loader: 'json-loader' },
{ test: /\.xml$/, loader: 'raw-loader' },
{ test: /\.ttf$/, loader: 'file-loader' }
]
},
resolve: {
modules: [
__dirname +'/js',
__dirname,
'node_modules',
'/usr/lib/node_modules'
]
},
plugins: [
new webpack.DefinePlugin ({ _DEV_MODE: devMode })
],
devServer: {
inline: true,
host: '0.0.0.0',
port: '9000',
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;