This repository has been archived by the owner on Mar 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
102 lines (99 loc) · 3.67 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
const { merge } = require('webpack-merge');
const singleSpaDefaults = require('webpack-config-single-spa');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const WebpackPwaManifest = require('webpack-pwa-manifest');
const { InjectManifest } = require('workbox-webpack-plugin');
module.exports = (webpackConfigEnv, argv) => {
const orgName = 'profcomff';
const defaultConfig = singleSpaDefaults({
orgName,
projectName: 'root-config',
webpackConfigEnv,
argv,
disableHtmlGeneration: true,
});
let nonlocal_plugins = !webpackConfigEnv.local ? [new InjectManifest({ swSrc: './src/service-worker.js' })] : [];
return merge(defaultConfig, {
module: {
rules: [
{
test: /\.(scss)$/,
use: [
{
loader: 'style-loader',
},
{
loader: 'css-loader',
},
{
loader: 'postcss-loader',
options: {
postcssOptions: {
plugins: () => [require('autoprefixer')],
},
},
},
{
loader: 'sass-loader',
},
],
},
],
},
plugins: [
new HtmlWebpackPlugin({
inject: false,
favicon: 'static/favicon.ico',
template: 'src/index.ejs',
templateParameters: {
local: webpackConfigEnv && webpackConfigEnv.local,
production: webpackConfigEnv && webpackConfigEnv.production,
development: webpackConfigEnv && webpackConfigEnv.development,
orgName,
},
}),
new WebpackPwaManifest({
name: 'Твой физфак!',
short_name: 'Твой ФФ!',
description: 'Приложение с сервисами для студентов и сотрудников физического факультета МГУ',
display: 'standalone',
theme_color: '#00004b',
background_color: '#00004b',
crossorigin: 'use-credentials',
icons: [
{
src: './static/icon.png',
sizes: [120, 152, 167, 180, 1024],
destination: 'icons/ios',
ios: true,
},
{
src: './static/icon.png',
size: 1024,
destination: 'icons/ios',
ios: 'startup',
},
{
src: './static/icon.png',
sizes: [36, 48, 72, 96, 144, 192, 512],
destination: 'icons/android',
},
{
src: './static/maskable_icon.png',
sizes: [36, 48, 72, 96, 144, 192, 512, 1024],
purpose: 'maskable',
},
],
ios: true,
publicPath: '/',
start_url: '/timetable',
}),
...nonlocal_plugins,
],
devServer: {
hot: false,
liveReload: false,
},
watch: false,
});
};