-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.config.cjs
61 lines (60 loc) · 1.63 KB
/
webpack.config.cjs
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
59
60
61
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: path.resolve(__dirname, './src/index.js'),
output: {
filename: 'gazpar-card.js',
path: path.resolve(__dirname, 'dist'),
clean: true,
publicPath: ''
},
module: {
rules: [
{
test: /\.(png|svg|jpg|jpeg|gif)$/i,
type: 'asset/inline',
},
],
},
resolve: {
modules: [path.resolve(__dirname, 'node_modules'), 'node_modules']
},
plugins: [
new webpack.DefinePlugin({
VERSION: JSON.stringify(require("./package.json").version),
COMPATIBLE_INTEGRATION_VERSION: JSON.stringify(require("./package.json").compatibleIntegrationVersion),
COMPATIBLE_GAZPAR2MQTT_VERSION: JSON.stringify(require("./package.json").compatibleGazpar2MQTTVersion),
}),
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'src/index.html',
inject: false
}),
new HtmlWebpackPlugin({
filename: 'daily-chart-test.html',
template: 'tests/daily-chart-test.html',
inject: false
}),
new HtmlWebpackPlugin({
filename: 'weekly-chart-test.html',
template: 'tests/weekly-chart-test.html',
inject: false
}),
new HtmlWebpackPlugin({
filename: 'monthly-chart-test.html',
template: 'tests/monthly-chart-test.html',
inject: false
})
,
new HtmlWebpackPlugin({
filename: 'yearly-chart-test.html',
template: 'tests/yearly-chart-test.html',
inject: false
})
],
performance: {
maxAssetSize: 400000,
maxEntrypointSize: 400000,
},
};