Skip to content

Commit 07fceb1

Browse files
committed
Upgrade all packages
1 parent 04897b8 commit 07fceb1

File tree

5 files changed

+1115
-2444
lines changed

5 files changed

+1115
-2444
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,8 @@ There are several scripts defined in the `package.json` file:
258258

259259
```json
260260
{
261-
"build": "webpack --env.NODE_ENV=production",
262-
"start": "webpack --watch --env.NODE_ENV=development",
261+
"build": "webpack --mode=production",
262+
"start": "webpack --watch --mode=development",
263263
"optisize": "optisize --src=\"./assets/images\"",
264264
"html": "php index.php > index.html",
265265
"critical": "critical index.html > assets/dist/critical.css",

package.json

+10-10
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"version": "3.6.1",
44
"description": "Multi page app setup with webpack",
55
"scripts": {
6-
"build": "webpack --NODE_ENV=production",
7-
"start": "webpack --watch --NODE_ENV=development",
6+
"build": "webpack --mode=production",
7+
"start": "webpack --watch --mode=development",
88
"optisize": "optisize --src=\"./assets/images\"",
99
"html": "php index.php > index.html",
1010
"critical": "node critical.js",
@@ -41,12 +41,12 @@
4141
"clean-webpack-plugin": "1.0.1",
4242
"create-pwa": "2.3.1",
4343
"critical": "3.0.0",
44-
"css-loader": "3.5.3",
44+
"css-loader": "5.1.1",
4545
"cssnano": "4.1.10",
4646
"eslint": "7.21.0",
4747
"eslint-config-recommended": "4.1.0",
48-
"extract-text-webpack-plugin": "4.0.0-beta.0",
4948
"file-loader": "6.2.0",
49+
"mini-css-extract-plugin": "1.3.9",
5050
"postcss": "8.2.7",
5151
"postcss-calc": "8.0.0",
5252
"postcss-cli": "8.3.1",
@@ -57,10 +57,10 @@
5757
"postcss-extend": "1.0.5",
5858
"postcss-flexbugs-fixes": "5.0.2",
5959
"postcss-for": "2.1.1",
60-
"postcss-loader": "4.2.0",
60+
"postcss-loader": "5.1.0",
6161
"postcss-merge-rules": "4.0.3",
62-
"postcss-mixins": "6.2.3",
63-
"postcss-nested": "4.2.3",
62+
"postcss-mixins": "7.0.3",
63+
"postcss-nested": "5.0.5",
6464
"postcss-normalize": "9.0.0",
6565
"postcss-preset-env": "6.7.0",
6666
"postcss-url": "10.1.1",
@@ -69,9 +69,9 @@
6969
"spritesh": "1.2.1",
7070
"stylelint": "13.12.0",
7171
"stylelint-config-recommended": "4.0.0",
72-
"webpack": "4.46.0",
73-
"webpack-cli": "3.3.12",
74-
"webpack-shell-plugin": "0.5.0",
72+
"webpack": "5.24.4",
73+
"webpack-cli": "4.5.0",
74+
"webpack-shell-plugin-next": "2.1.2",
7575
"webpack-spritesmith": "1.1.0",
7676
"yargs": "16.2.0"
7777
},

renovate.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@
99
"vulnerabilityAlerts": {
1010
"labels": ["security"],
1111
"assignees": ["@scriptex"]
12-
},
13-
"ignoreDeps": ["css-loader"]
12+
}
1413
}

webpack.config.js

+49-47
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
// @ts-nocheck
22

3-
const fs = require('fs');
4-
const path = require('path');
53
const { exec } = require('child_process');
6-
const { argv } = require('yargs');
74
const { parse } = require('url');
5+
const { resolve } = require('path');
6+
const { readdirSync } = require('fs');
87

8+
const { argv } = require('yargs');
99
const { ProvidePlugin } = require('webpack');
10-
const ExtractTextPlugin = require('extract-text-webpack-plugin');
1110
const SpritesmithPlugin = require('webpack-spritesmith');
1211
const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
13-
const WebpackShellPlugin = require('webpack-shell-plugin');
12+
const WebpackShellPlugin = require('webpack-shell-plugin-next');
1413
const CleanWebpackPlugin = require('clean-webpack-plugin');
14+
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
1515

16-
const { url, server, NODE_ENV } = argv;
16+
const { url, server, mode } = argv;
1717
const sourceMap = {
18-
sourceMap: NODE_ENV === 'development'
18+
sourceMap: mode === 'development'
1919
};
2020

2121
if (server) {
@@ -24,22 +24,22 @@ if (server) {
2424

2525
const svgoConfig = {
2626
plugins: [
27-
{ cleanupAttrs: true },
28-
{ removeDoctype: true },
29-
{ removeXMLProcInst: true },
30-
{ removeComments: true },
31-
{ removeMetadata: true },
32-
{ removeUselessDefs: true },
33-
{ removeEditorsNSData: true },
34-
{ removeEmptyAttrs: true },
35-
{ removeHiddenElems: false },
36-
{ removeEmptyText: true },
37-
{ removeEmptyContainers: true },
38-
{ cleanupEnableBackground: true },
39-
{ removeViewBox: false },
40-
{ cleanupIDs: false },
41-
{ convertStyleToAttrs: true },
42-
{ removeUselessStrokeAndFill: true }
27+
{ name: 'cleanupAttrs', active: true },
28+
{ name: 'removeDoctype', active: true },
29+
{ name: 'removeXMLProcInst', active: true },
30+
{ name: 'removeComments', active: true },
31+
{ name: 'removeMetadata', active: true },
32+
{ name: 'removeUselessDefs', active: true },
33+
{ name: 'removeEditorsNSData', active: true },
34+
{ name: 'removeEmptyAttrs', active: true },
35+
{ name: 'removeHiddenElems', active: false },
36+
{ name: 'removeEmptyText', active: true },
37+
{ name: 'removeEmptyContainers', active: true },
38+
{ name: 'cleanupEnableBackground', active: true },
39+
{ name: 'removeViewBox', active: false },
40+
{ name: 'cleanupIDs', active: false },
41+
{ name: 'convertStyleToAttrs', active: true },
42+
{ name: 'removeUselessStrokeAndFill', active: true }
4343
]
4444
};
4545

@@ -124,18 +124,17 @@ const browserSyncConfig = {
124124
};
125125

126126
const extractTextConfig = {
127-
filename: 'dist/app.css',
128-
allChunks: true
127+
filename: 'dist/app.css'
129128
};
130129

131130
const spritesmithConfig = {
132131
src: {
133-
cwd: path.resolve(__dirname, 'assets/images/sprite'),
132+
cwd: resolve(__dirname, 'assets/images/sprite'),
134133
glob: '*.png'
135134
},
136135
target: {
137-
image: path.resolve(__dirname, './assets/dist/sprite.png'),
138-
css: path.resolve(__dirname, './assets/styles/_sprite.css')
136+
image: resolve(__dirname, './assets/dist/sprite.png'),
137+
css: resolve(__dirname, './assets/styles/_sprite.css')
139138
},
140139
apiOptions: {
141140
cssImageRef: '../dist/sprite.png'
@@ -150,16 +149,16 @@ const cleanConfig = {
150149
};
151150

152151
const shellScripts = [];
153-
const svgs = fs.readdirSync('./assets/images/svg').filter(svg => svg[0] !== '.');
152+
const svgs = readdirSync('./assets/images/svg').filter(svg => svg[0] !== '.');
154153

155154
if (svgs.length) {
156155
shellScripts.push('svgo -f assets/images/svg --config=' + JSON.stringify(svgoConfig));
157156
shellScripts.push('spritesh -q -i assets/images/svg -o ./assets/dist/sprite.svg -p svg-');
158157
}
159158

160159
module.exports = () => {
161-
const isDevelopment = NODE_ENV === 'development';
162-
const isProduction = NODE_ENV === 'production';
160+
const isDevelopment = mode === 'development';
161+
const isProduction = mode === 'production';
163162

164163
if (isProduction) {
165164
postcssOptions.plugins.push(require('postcss-merge-rules'), require('cssnano')());
@@ -175,10 +174,10 @@ module.exports = () => {
175174
}
176175

177176
const config = {
178-
mode: NODE_ENV,
177+
mode: mode,
179178
entry: ['./assets/styles/main.css', './assets/scripts/main.js'],
180179
output: {
181-
path: path.resolve(__dirname, './assets'),
180+
path: resolve(__dirname, './assets'),
182181
filename: 'dist/app.js'
183182
},
184183
resolve: {
@@ -188,18 +187,19 @@ module.exports = () => {
188187
rules: [
189188
{
190189
test: /\.(sa|sc|c)ss$/,
191-
use: ExtractTextPlugin.extract({
192-
use: [
193-
{
194-
loader: 'css-loader',
195-
options: sourceMap
196-
},
197-
{
198-
loader: 'postcss-loader',
199-
options: { postcssOptions }
200-
}
201-
]
202-
})
190+
use: [
191+
{
192+
loader: MiniCssExtractPlugin.loader
193+
},
194+
{
195+
loader: 'css-loader',
196+
options: sourceMap
197+
},
198+
{
199+
loader: 'postcss-loader',
200+
options: { postcssOptions }
201+
}
202+
]
203203
},
204204
{
205205
test: /\.js$/,
@@ -228,11 +228,13 @@ module.exports = () => {
228228
jQuery: 'jquery',
229229
'window.jQuery': 'jquery'
230230
}),
231-
new ExtractTextPlugin(extractTextConfig),
231+
new MiniCssExtractPlugin(extractTextConfig),
232232
new SpritesmithPlugin(spritesmithConfig),
233233
new CleanWebpackPlugin(['../assets/dist/'], cleanConfig),
234234
new WebpackShellPlugin({
235-
onBuildStart: shellScripts
235+
onBuildStart: {
236+
scripts: shellScripts
237+
}
236238
})
237239
],
238240
externals: {

0 commit comments

Comments
 (0)