mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2024-12-26 23:25:55 -05:00
a03b98631a
* Changes to allow active development of UI using webpack and hotloading. * Update to webpack 4 (will make this work) * Update webpack.config.js accordingly * Move webpack.config.js to its own directory * Split webpack.config.js into base.config.js, dev.config.js and prod.config.js * Update configs to be "right" for development vs production using --mode * Want configuration through (optional) local file that is not checked in * Updated package.json for newer babel-loader * Put in a proxy to localhost port 8080 for evelopment server. This allows "yarn start" to work on the machine where MoonFire's server is running. This would be the default situation. Users in a different setup can change the proxy settings.
43 lines
1.1 KiB
JavaScript
43 lines
1.1 KiB
JavaScript
const path = require('path');
|
|
const webpack = require('webpack');
|
|
|
|
|
|
const project_root = path.join(__dirname, '../');
|
|
const src_dir = path.join(project_root, 'ui-src');
|
|
const dist_dir = path.join(project_root, 'ui-dist');
|
|
|
|
module.exports = {
|
|
entry: {
|
|
nvr: path.join(src_dir, 'index.js'),
|
|
},
|
|
output: {
|
|
filename: 'bundle.js',
|
|
path: path.resolve(dist_dir),
|
|
},
|
|
module: {
|
|
rules: [{
|
|
test: /\.js$/,
|
|
loader: 'babel',
|
|
query: {
|
|
'presets': ['env', {}],
|
|
},
|
|
include: [path.resolve(__dirname, './ui-src'), path.resolve(__dirname, './ui-src/lib')],
|
|
}, {
|
|
test: /\.png$/,
|
|
use: ['file-loader'],
|
|
}, {
|
|
test: /\.css$/,
|
|
loader: 'style-loader!css-loader',
|
|
}],
|
|
},
|
|
plugins: [
|
|
new webpack.IgnorePlugin(/\.\/locale$/),
|
|
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'),
|
|
],
|
|
};
|