-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
90 lines (89 loc) · 2.17 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
require('webpack')
const HtmlWebPackPlugin = require('html-webpack-plugin')
const FaviconsWebpackPlugin = require('favicons-webpack-plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const CompressionPlugin = require('compression-webpack-plugin')
const OfflinePlugin = require('offline-plugin')
const GoogleFontsPlugin = require('@beyonk/google-fonts-webpack-plugin')
const path = require('path')
module.exports = {
entry: './src/index.js',
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: { loader: 'babel-loader' }
},
{
test: /\.(scss)$/,
use: [
{ loader: 'style-loader' },
{ loader: 'css-loader',
options: {
modules: true,
localIdentName: '[local]-[hash:base64:5]'
}
},
{ loader: 'sass-loader' }
]
}
]
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
publicPath: './'
},
resolve: {
alias: {
'~': path.resolve(__dirname, 'src'),
'node_modules': path.resolve(__dirname, 'node_modules')
},
extensions: ['.js', '.jsx']
},
mode: 'development',
plugins: [
new GoogleFontsPlugin({
fonts: [{ family: 'Open Sans' }],
formats: ['woff', 'woff2'],
path: './',
filename: './fonts.css'
}),
new HtmlWebPackPlugin({
template: './src/index.html',
filename: './index.html'
}),
new FaviconsWebpackPlugin({
logo: './favicon.svg',
favicons: {
start_url: '.',
theme_color: '#541EB0',
appName: 'Rikiki',
appShortName: 'Rikiki',
appDescription: 'Helps you keep score in Rikiki',
background: '#541EB0'
},
prefix: './'
}),
new CompressionPlugin(),
new OfflinePlugin()
],
devtool: 'inline-source-map',
devServer: {
historyApiFallback: true,
publicPath: '/'
},
optimization: {
minimizer: [new UglifyJsPlugin()],
splitChunks: {
cacheGroups: {
commons: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'all'
}
}
}
}
}