This repository has been archived by the owner on Jul 11, 2024. It is now read-only.
forked from TheoLemoine/WorkShopLouvre
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.common.js
129 lines (128 loc) · 4.1 KB
/
webpack.common.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
const path = require('path')
const CopyPlugin = require('copy-webpack-plugin')
const WorkboxPlugin = require('workbox-webpack-plugin');
module.exports = {
entry: path.resolve(__dirname, 'src/app/index.tsx'),
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
publicPath: '/',
},
plugins: [
new CopyPlugin([
{
from: path.resolve(__dirname, 'src/index.html'),
to: path.resolve(__dirname, 'dist/index.html'),
},
]),
new CopyPlugin([
{
from: path.resolve(__dirname, 'src/manifest.json'),
to: path.resolve(__dirname, 'dist/manifest.json'),
},
]),
new CopyPlugin([
{
from: path.resolve(__dirname, 'src/worker.js'),
to: path.resolve(__dirname, 'dist/worker.js'),
},
]),
new CopyPlugin([
{
from: path.resolve(__dirname, 'src/favicon.ico'),
to: path.resolve(__dirname, 'dist/favicon.ico'),
},
]),
new CopyPlugin([
{
from: path.resolve(__dirname, 'src/logo.png'),
to: path.resolve(__dirname, 'dist/logo.png'),
},
]),
new CopyPlugin([
{
from: path.resolve(__dirname, 'src/logo192.png'),
to: path.resolve(__dirname, 'dist/logo192.png'),
},
]),
new CopyPlugin([
{
from: path.resolve(__dirname, 'src/logo512.png'),
to: path.resolve(__dirname, 'dist/logo512.png'),
},
]),
new CopyPlugin([
{
from: path.resolve(__dirname, 'src/robots.txt'),
to: path.resolve(__dirname, 'dist/robots.txt'),
},
]),
new WorkboxPlugin.GenerateSW({
clientsClaim: true,
skipWaiting: true,
}),
],
module: {
rules: [
{
test: /\.(js|jsx|tsx|ts)$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
{
test: /\.s[ac]ss$/i,
use: [
'style-loader',
'css-loader',
'postcss-loader',
'resolve-url-loader',
'sass-loader',
],
},
{
test: /\.raw.svg$/i,
use: 'svg-inline-loader',
},
{
test: /\.(gif|png|jpe?g|(?<!raw.)svg|woff2?|ttf|otf|eot)$/i,
use: [
{
loader: 'file-loader',
options: {
name: '[path][name].[ext]',
},
},
{
loader: 'image-webpack-loader',
options: {
bypassOnDebug: true, // [email protected]
disable: true, // [email protected] and newer
mozjpeg: {
progressive: true,
quality: 65
},
// optipng.enabled: false will disable optipng
optipng: {
enabled: false,
},
pngquant: {
quality: [0.65, 0.90],
speed: 4
},
gifsicle: {
interlaced: false,
},
// the webp option will enable WEBP
webp: {
quality: 75
}
},
},
],
},
],
},
resolve: {
extensions: ['*', '.js', '.jsx', '.tsx', '.ts'],
},
}