Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): upgrade webpack to v5 #9

Merged
merged 1 commit into from
Nov 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 6 additions & 94 deletions config/__snapshots__/webpack.config.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,11 @@ Object {
"minimizer": Array [
TerserPlugin {
"options": Object {
"cache": true,
"cacheKeys": [Function],
"exclude": undefined,
"extractComments": true,
"include": undefined,
"minify": undefined,
"parallel": true,
"sourceMap": undefined,
"terserOptions": Object {
"warnings": false,
},
Expand All @@ -51,40 +48,21 @@ Object {
],
"splitChunks": Object {
"cacheGroups": Object {
"vendors": Object {
"defaultVendors": Object {
"priority": -10,
"test": /\\[\\\\\\\\/\\]node_modules\\[\\\\\\\\/\\]/,
},
},
"chunks": "async",
"minChunks": 1,
"minSize": 30000,
"name": true,
},
},
"output": Object {
"filename": "[name].[chunkhash].js",
"path": "<PROJECT_ROOT>/dist",
},
"plugins": Array [
CleanWebpackPlugin {
"apply": [Function],
"cleanAfterEveryBuildPatterns": Array [],
"cleanOnceBeforeBuildPatterns": Array [
"**/*",
],
"cleanStaleWebpackAssets": true,
"currentAssets": Array [],
"dangerouslyAllowCleanPatternsOutsideProject": false,
"dry": false,
"handleDone": [Function],
"handleInitial": [Function],
"initialClean": false,
"outputPath": "",
"protectWebpackAssets": true,
"removeFiles": [Function],
"verbose": false,
},
ESLintWebpackPlugin {
"options": Object {
"cache": true,
Expand All @@ -104,39 +82,17 @@ Object {
},
"run": [Function],
},
[Function],
DefinePlugin {
"definitions": Object {
"__DEV__": "true",
},
},
HtmlWebpackPlugin {
"assetJson": undefined,
"childCompilerHash": undefined,
"hash": undefined,
"options": Object {
"base": false,
"cache": true,
"chunks": "all",
"chunksSortMode": "auto",
"compile": true,
"excludeChunks": Array [],
"favicon": false,
"filename": "index.html",
"hash": false,
"inject": "body",
"meta": Object {},
"minify": "auto",
"publicPath": "auto",
"scriptLoading": "blocking",
"showErrors": true,
"userOptions": Object {
"template": "<PROJECT_ROOT>/client/index.html",
"templateContent": false,
"templateParameters": [Function],
"title": "trshcmpctr",
"xhtml": false,
},
"version": 4,
"version": 5,
},
],
"resolve": Object {
Expand Down Expand Up @@ -184,14 +140,11 @@ Object {
"minimizer": Array [
TerserPlugin {
"options": Object {
"cache": true,
"cacheKeys": [Function],
"exclude": undefined,
"extractComments": true,
"include": undefined,
"minify": undefined,
"parallel": true,
"sourceMap": undefined,
"terserOptions": Object {
"warnings": false,
},
Expand All @@ -201,40 +154,21 @@ Object {
],
"splitChunks": Object {
"cacheGroups": Object {
"vendors": Object {
"defaultVendors": Object {
"priority": -10,
"test": /\\[\\\\\\\\/\\]node_modules\\[\\\\\\\\/\\]/,
},
},
"chunks": "async",
"minChunks": 1,
"minSize": 30000,
"name": true,
},
},
"output": Object {
"filename": "[name].[chunkhash].js",
"path": "<PROJECT_ROOT>/dist",
},
"plugins": Array [
CleanWebpackPlugin {
"apply": [Function],
"cleanAfterEveryBuildPatterns": Array [],
"cleanOnceBeforeBuildPatterns": Array [
"**/*",
],
"cleanStaleWebpackAssets": true,
"currentAssets": Array [],
"dangerouslyAllowCleanPatternsOutsideProject": false,
"dry": false,
"handleDone": [Function],
"handleInitial": [Function],
"initialClean": false,
"outputPath": "",
"protectWebpackAssets": true,
"removeFiles": [Function],
"verbose": false,
},
ESLintWebpackPlugin {
"options": Object {
"cache": true,
Expand All @@ -254,39 +188,17 @@ Object {
},
"run": [Function],
},
[Function],
DefinePlugin {
"definitions": Object {
"__DEV__": "false",
},
},
HtmlWebpackPlugin {
"assetJson": undefined,
"childCompilerHash": undefined,
"hash": undefined,
"options": Object {
"base": false,
"cache": true,
"chunks": "all",
"chunksSortMode": "auto",
"compile": true,
"excludeChunks": Array [],
"favicon": false,
"filename": "index.html",
"hash": false,
"inject": "body",
"meta": Object {},
"minify": "auto",
"publicPath": "auto",
"scriptLoading": "blocking",
"showErrors": true,
"userOptions": Object {
"template": "<PROJECT_ROOT>/client/index.html",
"templateContent": false,
"templateParameters": [Function],
"title": "trshcmpctr",
"xhtml": false,
},
"version": 4,
"version": 5,
},
],
"resolve": Object {
Expand Down
11 changes: 1 addition & 10 deletions config/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
const chalk = require('chalk');
const CleanWebpackPlugin = require('clean-webpack-plugin').CleanWebpackPlugin;
const ESLintPlugin = require('eslint-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const webpack = require('webpack');

Expand Down Expand Up @@ -63,20 +60,18 @@ module.exports = (env = {}, argv = {}) => {

splitChunks: {
cacheGroups: {
vendors: {
defaultVendors: {
priority: -10,
test: /[\\/]node_modules[\\/]/
}
},
chunks: 'async',
minChunks: 1,
minSize: 30000,
name: true,
},
},

plugins: [
new CleanWebpackPlugin(),
new ESLintPlugin({
cache: true,
cacheLocation: 'node_modules/.cache/eslint-cache/',
Expand All @@ -87,10 +82,6 @@ module.exports = (env = {}, argv = {}) => {
lintDirtyModulesOnly: !!argv.watch,
reportUnusedDisableDirectives: !isProduction ? 'warn' : null,
}),
new ProgressBarPlugin({
format: ' build [:bar] ' + chalk.green.bold(':percent') + ' (:elapsed seconds)',
clear: false
}),
new webpack.DefinePlugin({
__DEV__: JSON.stringify(!isProduction),
}),
Expand Down
5 changes: 0 additions & 5 deletions config/webpack.config.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const CleanWebpackPlugin = require('clean-webpack-plugin').CleanWebpackPlugin;
const ESLintWebpackPlugin = require('eslint-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const serializer = require('jest-serializer-path');
Expand All @@ -25,16 +24,12 @@ describe('webpack', () => {

it('sets plugins', () => {
expect(developmentConfig.plugins).toMatchObject([
expect.any(CleanWebpackPlugin),
expect.any(ESLintWebpackPlugin),
expect.any(Function), // ProgressBarPlugin, anonymous function signature
expect.any(webpack.DefinePlugin),
expect.any(HtmlWebpackPlugin),
]);
expect(productionConfig.plugins).toMatchObject([
expect.any(CleanWebpackPlugin),
expect.any(ESLintWebpackPlugin),
expect.any(Function), // ProgressBarPlugin, anonymous function signature
expect.any(webpack.DefinePlugin),
expect.any(HtmlWebpackPlugin),
]);
Expand Down
Loading