-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
127 lines (125 loc) · 3.84 KB
/
webpack.config.js
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
const CopyPlugin = require('copy-webpack-plugin');
const FaviconsWebpackPlugin = require('favicons-webpack-plugin');
const title = 'Datathon FME';
const description = 'Join us in Barcelona on November 11-12 for Datathon FME – sign up now!';
const image = 'https://datathon.cat/img/promo.jpeg';
const metaTags = {
'description': { name: 'description', content: description },
'keyword': { name: 'keywords', content: 'Datathon FME,datathon.cat,datathon,Barcelona,data,data science,UPC,FME,Catalunya,Catalonia,hackathon,ML,machine learning,AI,artificial intelligence,November,11-12 November' },
'og:title': { property: 'og:title', content: title },
'og:description': { property: 'og:description', content: description },
'og:type': { property: 'og:type', content: 'website' },
'og:url': { property: 'og:url', content: 'https://datathon.cat' },
'og:image': { property: 'og:image', content: image },
'twitter:card': { name: 'twitter:card', content: 'summary_large_image' },
'twitter:title': { name: 'twitter:title', content: title },
'twitter:description': { name: 'twitter:description', content: description },
'twitter:image': { name: 'twitter:image', content: image }
}
module.exports = {
entry: {
app: './src/index/script.js',
legal: './src/legal/script.js',
generator: './src/generator/script.js'
},
module: {
rules: [
{
test: /\.css$/i,
use: [MiniCssExtractPlugin.loader, "css-loader"],
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: './src/index/index.html',
chunks: ['app'],
filename: 'index.html',
meta: metaTags,
}),
new HtmlWebpackPlugin({
template: './src/index/index.cat.html',
chunks: ['app'],
filename: 'ca/index.html',
meta: metaTags,
}),
new HtmlWebpackPlugin({
template: './src/legal/legal.html',
chunks: ['legal'],
filename: 'legal.html',
meta: metaTags,
}),
new HtmlWebpackPlugin({
template: './src/legal/legal.cat.html',
chunks: ['legal'],
filename: 'ca/legal.html',
meta: metaTags,
}),
new HtmlWebpackPlugin({
template: './src/legal/privacy.html',
chunks: ['legal'],
filename: 'privacy.html',
meta: metaTags,
}),
new HtmlWebpackPlugin({
template: './src/legal/privacy.cat.html',
chunks: ['legal'],
filename: 'ca/privacitat.html',
meta: metaTags,
}),
new HtmlWebpackPlugin({
template: './src/legal/terms.html',
chunks: ['legal'],
filename: 'terms.html',
meta: metaTags,
}),
new HtmlWebpackPlugin({
template: './src/legal/terms.cat.html',
chunks: ['legal'],
filename: 'ca/termes.html',
meta: metaTags,
}),
new HtmlWebpackPlugin({
template: './src/generator/index.html',
chunks: ['generator'],
filename: 'generator.html',
meta: metaTags,
}),
new MiniCssExtractPlugin(),
new CopyPlugin({
patterns: [{ from: 'public' }],
}),
new FaviconsWebpackPlugin({
logo: './public/img/logo-datathon.webp',
logoMaskable: './public/img/logo-datathon.webp',
prefix: '/',
favicons: {
appName: 'datathon.cat',
developerURL: 'https://github.com/data-students',
start_url: '/',
display: 'standalone',
theme_color: '#468f8b',
background: '#fff',
icons: {
yandex: false,
},
},
}),
],
optimization: {
minimizer: [
`...`,
new CssMinimizerPlugin(),
],
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist'),
clean: true,
},
mode: 'production',
};