mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2024-12-26 23:25:55 -05:00
5727adf3df
* Various settings in settings-nvr.js module * settings-nvr-local.js can override settings-nvr.js * settings-nvr-local is unchecked file * Both files can be straight maps, or functions returning maps * webpack env and args available to those functions
53 lines
1.4 KiB
JavaScript
53 lines
1.4 KiB
JavaScript
// vim: set et ts=2 sw=2:
|
|
//
|
|
|
|
const path = require('path');
|
|
const webpack = require('webpack');
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
const NVRSettings = require('./NVRSettings');
|
|
|
|
module.exports = (env, args) => {
|
|
const nvrSettings = new NVRSettings(env, args).settings;
|
|
|
|
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'],
|
|
}, {
|
|
// 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'),
|
|
],
|
|
};
|
|
};
|