moonfire-nvr/webpack/base.config.js
Dolf Starreveld 5727adf3df Settings can now be taken from separate file with local override.
* 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
2018-03-08 18:26:41 -08:00

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'),
],
};
};