-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
84 lines (83 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
const HtmlWebPackPlugin = require('html-webpack-plugin')
const CleanWebpackPlugin = require('clean-webpack-plugin')
const WebpackPwaManifest = require('webpack-pwa-manifest')
// const WorkBoxPlugin = require('workbox-webpack-plugin')
const path = require('path')
module.exports = {
mode: 'development',
devtool: 'eval-source-map',
devServer: {
historyApiFallback: { index: 'dist/index.html' }
},
module: {
rules: [
{
test: /\.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.s(a|c)ss$/,
loader: ['style-loader', 'css-loader', 'sass-loader']
},
{
test: /\.html$/,
loader: 'html-loader'
}
]
},
resolve: {
extensions: ['.js', '.scss']
},
// entry: {
// bundle: './src/index.js'
// index: './src/index.js',
// },
// output: {
// path: path.resolve(__dirname, 'dist'),
// filename: '[name].js'
// },
// devServer: {
// contentBase: path.join(__dirname, 'dist'),
// hot: true,
// host: '0.0.0.0',
// inline: true
// },
plugins: [
new CleanWebpackPlugin(),
new HtmlWebPackPlugin({
template: './src/index.html',
filename: './index.html'
}),
new WebpackPwaManifest({
name: 'My Progressive Web App',
short_name: 'MyPWA',
description: 'My awesome Progressive Web App!',
background_color: '#ffffff',
crossorigin: 'use-credentials', //can be null, use-credentials or anonymous
icons: [
// {
// src: path.resolve('src/assets/icon.png'),
// sizes: [96, 128, 192, 256, 384, 512] // multiple sizes
// },
{
src: path.resolve('src/assets/leaf.png'),
size: '1024x1024' // you can also use the specifications pattern
},
// {
// src: path.resolve('src/assets/maskable-icon.png'),
// size: '1024x1024',
// purpose: 'maskable'
// }
]
}),
// new WorkBoxPlugin.InjectManifest({
// swSrc: './sw.js',
// additionalManifestEntries: []
// })
// new WorkBoxPlugin.GenerateSW({
// clientsClaim: true,
// skipWaiting: true,
// })
]
}