-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathwebpack.config.js
executable file
·84 lines (82 loc) · 2.13 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
const path = require('path');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CleanWebpackPlugin = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const WebpackPwaManifest = require('webpack-pwa-manifest');
const pkg = require('./package.json');
module.exports = {
mode: process.env.WEBPACK_MODE,
entry: './src/js/main.js',
output: {
filename: 'js/main.js',
path: path.resolve(__dirname, 'dist')
},
module: {
rules: [{
test: /\.(s*)css$/,
use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader']
}, {
test: /\.html$/,
use: [{
loader: "html-loader",
options: {
interpolate: true
}
}]
}, {
test: /\.(png|svg(z*)|jp(e*)g|gif)$/,
use: [{
loader: 'file-loader',
options: {
name: "[hash]-[name].[ext]",
publicPath: (process.env.PATH_PREFIX || '') + "/img/",
outputPath: "img/",
}
}]
}]
},
plugins: [
new MiniCssExtractPlugin({
filename: "css/styles.css"
}),
new CleanWebpackPlugin(['dist']),
new HtmlWebpackPlugin({
filename: "index.html",
template: "src/html/index.html",
title: "Vǐgǐlo",
meta: {
viewport: 'width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no',
robots: "index,follow"
}
}),
new HtmlWebpackPlugin({
template: "src/html/stats-iframe.html",
filename: "stats-iframe.html",
title: "Vǐgǐlo"
}),
new WebpackPwaManifest({
name: 'Vǐgǐlo',
short_name: 'Vǐgǐlo',
description: 'Vigilo est une application qui permet aux citoyens qui se déplacent avec des moyens de locomotion non motorisés (piétons, cyclistes, ...) de remonter des observations sur les problèmes de déplacements auxquels ils font face au quotidien.',
lang: "fr",
background_color: '#fdd835',
theme_color: '#fdd835',
ios: true,
icons: [{
src: path.resolve('src/img/favicon.png'),
sizes: [48, 72, 96]
},
{
src: path.resolve('src/img/vigilo.png'),
sizes: [128, 192, 256, 384, 512, 1024]
}
]
})
],
devServer: {
contentBase: path.join(__dirname, 'dist'),
compress: false,
host: "0.0.0.0",
port: 80
}
};