ctucx.git: mqtt-webui

webui for mqtt, can be used to control/display data in mqtt-topics

1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
28 
29 
30 
31 
32 
33 
34 
35 
36 
37 
38 
39 
40 
41 
42 
43 
44 
45 
46 
47 
48 
49 
50 
51 
52 
53 
54 
55 
56 
57 
58 
import { fileURLToPath }    from 'url';
import path                 from 'path';
import webpack              from 'webpack';

import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import CssMinimizerPlugin   from 'css-minimizer-webpack-plugin';
import TerserPlugin         from 'terser-webpack-plugin';

const __filename = fileURLToPath(import.meta.url);
const __dirname  = path.dirname(__filename);

export default {
	mode: 'production',

	entry: {
		bundle: [
			'./src/webui.js',
		],
	},

	output: {
		path: path.resolve(__dirname, './www'),
		publicPath: '/',
		filename: '[name].js',
	},

	performance: {
		hints: false,
	},

	module: {
		rules: [
			{
			   test: /.s?css$/,
				use: [MiniCssExtractPlugin.loader, "css-loader", "sass-loader"],
			},
		],
	},

	optimization: {
		minimizer: [
			new CssMinimizerPlugin(),
		],
	},

	plugins: [
		new TerserPlugin(),
		new MiniCssExtractPlugin(),
		new webpack.LoaderOptionsPlugin({
			minimize: true,
		}),
		new webpack.ProvidePlugin({
			Buffer: [ 'buffer', 'Buffer' ],
			process: 'process/browser',
			url: 'url'
		}),
	],
};