-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
webpack.config.js
55 lines (53 loc) · 1.41 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
const HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = (env) => {
const isProd = env.target === "prod";
return {
output: {
clean: true,
},
mode: isProd ? "production" : "development",
plugins: [
new HtmlWebpackPlugin({
// Do not inject assets (import them inside template)
inject: false,
// Load custom template (by default use lodash syntax)
template: "./template.ejs",
// `title`, `attributes`, `head`, `body` variables are exposed inside
// the template:
title: "HTML Template",
attributes: {
html: {
lang: "en",
},
js: {
defer: true,
},
},
head: {
meta: [
{
name: "description",
content: "Custom webpack html template",
},
],
links: [
{
href: "https://fonts.googleapis.com/css?family=Roboto:400&display=swap",
rel: "stylesheet",
},
],
},
body: {
scripts: [
{
src: "https://polyfill.io/v3/polyfill.min.js?flags=gated",
type: "text/javascript",
crossorigin: "anonymous",
defer: true,
},
],
},
}),
],
};
};