-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.common.js
More file actions
executable file
·82 lines (81 loc) · 1.93 KB
/
webpack.common.js
File metadata and controls
executable file
·82 lines (81 loc) · 1.93 KB
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
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const WebpackPwaManifest = require('webpack-pwa-manifest')
const ServiceWorkerWebpackPlugin = require('serviceworker-webpack-plugin')
module.exports = {
entry: [
'react-hot-loader/patch',
'./src/index.js',
],
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].bundle.[hash].js',
},
optimization: {
splitChunks: {
chunks: 'all',
},
},
module: {
rules: [
{
test: /\.js?$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
plugins: [
'transform-object-rest-spread',
'styled-components',
],
},
},
},
{
test: /.(png|jpg|jp(e)?g|svg|ico)(\?[a-z0-9]+)?$/,
use: {
loader: 'file-loader',
options: {
name: 'images/[name].[ext]',
},
},
},
{
test: /.(ttf|otf|eot|woff(2)?)(\?[a-z0-9]+)?$/,
use: {
loader: 'file-loader',
options: {
name: 'fonts/[name].[ext]',
},
},
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: './src/index.html',
}),
new CopyWebpackPlugin([{
from: './src/assets/img/logo.png',
to: 'images/',
}]),
new WebpackPwaManifest({
name: 'WebMadeira',
short_name: 'WebMadeira',
description: 'A non-profit event built by-the-community, for-the-community.',
theme_color: '#14455a',
background_color: '#14455a',
crossorigin: null,
icons: [
{
src: path.resolve('./src/assets/img/logo.png'),
sizes: [96, 128, 192, 256, 384, 512],
},
],
}),
new ServiceWorkerWebpackPlugin({
entry: path.join(__dirname, 'src/sw.js'),
}),
],
}