mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-12-07 16:22:31 -05:00
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
This commit is contained in:
@@ -1,15 +1,40 @@
|
||||
const path = require('path');
|
||||
// vim: set et ts=2 sw=2:
|
||||
//
|
||||
|
||||
const webpack = require('webpack');
|
||||
const merge = require('webpack-merge');
|
||||
const NVRSettings = require('./NVRSettings');
|
||||
const baseConfig = require('./base.config.js');
|
||||
|
||||
const CleanWebpackPlugin = require('clean-webpack-plugin');
|
||||
|
||||
module.exports = merge(baseConfig, {
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
'process.env.NODE_ENV': JSON.stringify('production'),
|
||||
}),
|
||||
new CleanWebpackPlugin(['ui-dist'], { root: path.resolve(__dirname, '../') }),
|
||||
],
|
||||
});
|
||||
module.exports = (env, args) => {
|
||||
const settingsObject = new NVRSettings(env, args);
|
||||
const nvrSettings = settingsObject.settings;
|
||||
|
||||
return settingsObject.webpackMerge(baseConfig, {
|
||||
optimization: {
|
||||
splitChunks: {
|
||||
cacheGroups: {
|
||||
default: {
|
||||
minChunks: 2,
|
||||
priority: -20,
|
||||
},
|
||||
commons: {
|
||||
test: /[\\/]node_modules[\\/]/,
|
||||
name: 'vendor',
|
||||
chunks: 'all',
|
||||
priority: -10,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
'process.env.NODE_ENV': JSON.stringify('production'),
|
||||
}),
|
||||
new CleanWebpackPlugin([nvrSettings.dist_dir], {
|
||||
root: nvrSettings._paths.project_root,
|
||||
}),
|
||||
],
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user