2018-03-07 16:09:43 -05:00
|
|
|
// vim: set et ts=2 sw=2:
|
|
|
|
//
|
|
|
|
|
2018-03-07 20:34:08 -05:00
|
|
|
const path = require('path');
|
|
|
|
const webpack = require('webpack');
|
2018-03-07 16:09:43 -05:00
|
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
|
|
const NVRSettings = require('./NVRSettings');
|
2018-03-07 20:34:08 -05:00
|
|
|
|
2018-03-07 16:09:43 -05:00
|
|
|
module.exports = (env, args) => {
|
|
|
|
const nvrSettings = new NVRSettings(env, args).settings;
|
2018-03-07 20:34:08 -05:00
|
|
|
|
2018-03-07 16:09:43 -05:00
|
|
|
return {
|
|
|
|
entry: {
|
|
|
|
nvr: path.join(nvrSettings._paths.app_src_dir, 'index.js'),
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
filename: '[name].bundle.js',
|
|
|
|
path: nvrSettings._paths.dist_dir,
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [{
|
|
|
|
test: /\.js$/,
|
|
|
|
loader: 'babel-loader',
|
|
|
|
query: {
|
|
|
|
'presets': ['env'],
|
|
|
|
},
|
|
|
|
exclude: /(node_modules|bower_components)/,
|
|
|
|
include: [ './ui-src'],
|
|
|
|
}, {
|
|
|
|
test: /\.png$/,
|
|
|
|
use: ['file-loader'],
|
2018-03-13 01:11:45 -04:00
|
|
|
}, {
|
|
|
|
test: /\.ico$/,
|
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: 'file-loader',
|
|
|
|
options: {
|
|
|
|
name: '[name].[ext]'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2018-03-07 16:09:43 -05:00
|
|
|
}, {
|
|
|
|
// Load css and then in-line in head
|
|
|
|
test: /\.css$/,
|
|
|
|
loader: 'style-loader!css-loader',
|
|
|
|
}],
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new webpack.IgnorePlugin(/\.\/locale$/),
|
|
|
|
new HtmlWebpackPlugin({
|
|
|
|
title: nvrSettings.app_title,
|
|
|
|
template: path.join(nvrSettings._paths.app_src_dir, 'index.html'),
|
|
|
|
}),
|
|
|
|
new webpack.NormalModuleReplacementPlugin(
|
|
|
|
/node_modules\/moment\/moment\.js$/,
|
|
|
|
'./min/moment.min.js'),
|
|
|
|
new webpack.NormalModuleReplacementPlugin(
|
|
|
|
/node_modules\/moment-timezone\/index\.js$/,
|
|
|
|
'./builds/moment-timezone-with-data-2012-2022.min.js'),
|
|
|
|
],
|
|
|
|
};
|
2018-03-07 20:34:08 -05:00
|
|
|
};
|