forked from vincentriemer/io-808
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.prod.js
executable file
·152 lines (151 loc) · 3.59 KB
/
webpack.config.prod.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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
var path = require("path");
var webpack = require("webpack");
var HtmlWebpackPlugin = require("html-webpack-plugin");
var FaviconsWebpackPlugin = require("favicons-webpack-plugin");
var UglifyJsPlugin = require("uglifyjs-webpack-plugin");
var MiniCssExtractPlugin = require("mini-css-extract-plugin");
var OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
var OfflinePlugin = require("offline-plugin");
var WebpackPwaManifest = require("webpack-pwa-manifest");
module.exports = {
mode: "production",
entry: [
"core-js/es6/symbol",
"core-js/es6/reflect",
"core-js/fn/array/includes",
"./src/index",
],
optimization: {
minimizer: [
new UglifyJsPlugin({
cache: true,
parallel: true,
sourceMap: true, // set to true if you want JS source maps
}),
new OptimizeCSSAssetsPlugin({}),
],
splitChunks: {
cacheGroups: {
styles: {
name: "styles",
test: /\.css$/,
chunks: "all",
enforce: true,
},
},
},
nodeEnv: "production",
},
output: {
path: path.join(__dirname, "out"),
filename: "bundle.js",
publicPath: "",
},
module: {
rules: [
{
test: /\.pug$/,
use: [{ loader: "pug-loader", options: {} }],
},
{
test: /\.css$/,
use: [
MiniCssExtractPlugin.loader,
{ loader: "css-loader", options: { importLoaders: 1 } },
{
loader: "postcss-loader",
options: {
ident: "postcss",
plugins: [require("autoprefixer")],
},
},
],
},
{
test: /\.js$/,
use: [
{
loader: "babel-loader",
options: {
include: path.join(__dirname, "src"),
},
},
],
},
{
test: /\.(otf|eot|svg|ttf|woff|woff2).*$/,
loader: "url-loader?limit=8192",
},
{
test: /\.(png|jpg|gif)$/,
use: [
{
loader: "file-loader",
options: {},
},
],
},
],
},
plugins: [
new FaviconsWebpackPlugin({
logo: "./base-favicon.png",
inject: true,
background: "#363830",
title: "iO-808",
icons: {
android: true,
appleIcon: true,
appleStartup: true,
coast: false,
favicons: true,
firefox: true,
opengraph: false,
twitter: true,
yandex: false,
windows: true,
},
}),
new HtmlWebpackPlugin({
inject: false,
cache: false,
minify: {
collapseWhitespace: true,
html5: true,
minifyCSS: true,
minifyJS: true,
removeComments: true,
useShortDoctype: true,
},
template: "src/index.pug",
filename: "index.html",
title: "iO-808",
}),
new WebpackPwaManifest({
lang: "en",
dir: "ltr",
name: "iO-808",
short_name: "io808",
description:
"A fully recreated web-based TR-808 drum machine using React, Redux, and the Web Audio API.",
background_color: "#363830",
theme_color: "#363830",
orientation: "landscape",
display: "standalone",
icons: [
{
src: path.resolve("./base-favicon.png"),
sizes: [96, 128, 192, 256, 384, 512],
},
],
}),
new MiniCssExtractPlugin({
filename: "styles.css",
}),
new OfflinePlugin(),
],
resolve: {
modules: [path.resolve(__dirname, "src"), "node_modules"],
extensions: [".js", ".json"],
},
};