From 4def9f3f99e053b8281f71be3fe3ad7553ca76d9 Mon Sep 17 00:00:00 2001 From: Ramon Date: Wed, 21 Jul 2021 10:28:20 -0300 Subject: [PATCH 1/2] Add webpack-remove-empty-scripts to 10up-toolkit package --- packages/toolkit/config/webpack/plugins.js | 2 ++ packages/toolkit/package.json | 1 + 2 files changed, 3 insertions(+) diff --git a/packages/toolkit/config/webpack/plugins.js b/packages/toolkit/config/webpack/plugins.js index 86680afa..92afe365 100644 --- a/packages/toolkit/config/webpack/plugins.js +++ b/packages/toolkit/config/webpack/plugins.js @@ -8,6 +8,7 @@ const StyleLintPlugin = require('stylelint-webpack-plugin'); const WebpackBar = require('webpackbar'); const path = require('path'); const HtmlWebpackPlugin = require('html-webpack-plugin'); +const RemoveEmptyScriptsPlugin = require('webpack-remove-empty-scripts'); const CleanExtractedDeps = require('../../utils/clean-extracted-deps'); const { hasStylelintConfig, fromConfigRoot, hasProjectFile } = require('../../utils'); @@ -101,5 +102,6 @@ module.exports = ({ injectPolyfill: true, }), new CleanExtractedDeps(), + new RemoveEmptyScriptsPlugin(), ].filter(Boolean); }; diff --git a/packages/toolkit/package.json b/packages/toolkit/package.json index cdcb4f90..d2f7fe6b 100644 --- a/packages/toolkit/package.json +++ b/packages/toolkit/package.json @@ -85,6 +85,7 @@ "webpack": "^5.41.1", "webpack-bundle-analyzer": "^4.4.2", "webpack-dev-server": "^3.11.2", + "webpack-remove-empty-scripts": "^0.7.1", "webpack-sources": "^2.3.0", "webpackbar": "^5.0.0-3" }, From 74b5d01366a2966d8961cd720b3ebbc2e131dbed Mon Sep 17 00:00:00 2001 From: Ramon Date: Wed, 21 Jul 2021 10:42:20 -0300 Subject: [PATCH 2/2] Update snapshots --- .../config/__tests__/__snapshots__/webpack.config.js.snap | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/toolkit/config/__tests__/__snapshots__/webpack.config.js.snap b/packages/toolkit/config/__tests__/__snapshots__/webpack.config.js.snap index 11d008f1..804e0c1c 100644 --- a/packages/toolkit/config/__tests__/__snapshots__/webpack.config.js.snap +++ b/packages/toolkit/config/__tests__/__snapshots__/webpack.config.js.snap @@ -168,6 +168,7 @@ Object { StylelintWebpackPlugin: {"extensions":["css","scss","sass"],"emitError":true,"emitWarning":true,"failOnError":true,"context":"/assets","files":"**/*.(s(c|a)ss|css)","allowEmptyInput":true,"configFile":"/config/stylelint.config.js"}, WebpackBarPlugin: {"name":"webpack","color":"green","reporters":["basic"],"reporter":null}, CleanExtractedDeps: {}, + WebpackRemoveEmptyScriptsPlugin: {"verbose":false,"extensions":["css","scss","sass","less","styl"],"scriptExtensions":["js","mjs"],"ignore":[]}, ], "resolve": Object { "alias": Object { @@ -344,6 +345,7 @@ Object { StylelintWebpackPlugin: {"extensions":["css","scss","sass"],"emitError":true,"emitWarning":true,"failOnError":true,"context":"/assets","files":"**/*.(s(c|a)ss|css)","allowEmptyInput":true}, WebpackBarPlugin: {"name":"webpack","color":"green","reporters":["basic"],"reporter":null}, CleanExtractedDeps: {}, + WebpackRemoveEmptyScriptsPlugin: {"verbose":false,"extensions":["css","scss","sass","less","styl"],"scriptExtensions":["js","mjs"],"ignore":[]}, ], "resolve": Object { "alias": Object { @@ -509,6 +511,7 @@ Object { WebpackBarPlugin: {"name":"webpack","color":"green","reporters":["basic"],"reporter":null}, DependencyExtractionWebpackPlugin: {"combineAssets":false,"combinedOutputFile":null,"injectPolyfill":true,"outputFormat":"php","useDefaults":true}, CleanExtractedDeps: {}, + WebpackRemoveEmptyScriptsPlugin: {"verbose":false,"extensions":["css","scss","sass","less","styl"],"scriptExtensions":["js","mjs"],"ignore":[]}, ], "resolve": Object { "alias": Object { @@ -706,6 +709,7 @@ Object { StylelintWebpackPlugin: {"extensions":["css","scss","sass"],"emitError":true,"emitWarning":true,"failOnError":true,"context":"/assets","files":"**/*.(s(c|a)ss|css)","allowEmptyInput":true,"configFile":"/config/stylelint.config.js"}, WebpackBarPlugin: {"name":"webpack","color":"green","reporters":["basic"],"reporter":null}, CleanExtractedDeps: {}, + WebpackRemoveEmptyScriptsPlugin: {"verbose":false,"extensions":["css","scss","sass","less","styl"],"scriptExtensions":["js","mjs"],"ignore":[]}, ], "resolve": Object { "alias": Object { @@ -895,6 +899,7 @@ Object { StylelintWebpackPlugin: {"extensions":["css","scss","sass"],"emitError":true,"emitWarning":true,"failOnError":true,"context":"/assets","files":"**/*.(s(c|a)ss|css)","allowEmptyInput":true,"configFile":"/config/stylelint.config.js"}, WebpackBarPlugin: {"name":"webpack","color":"green","reporters":["basic"],"reporter":null}, CleanExtractedDeps: {}, + WebpackRemoveEmptyScriptsPlugin: {"verbose":false,"extensions":["css","scss","sass","less","styl"],"scriptExtensions":["js","mjs"],"ignore":[]}, ], "resolve": Object { "alias": Object { @@ -1093,6 +1098,7 @@ Object { StylelintWebpackPlugin: {"extensions":["css","scss","sass"],"emitError":true,"emitWarning":true,"failOnError":true,"context":"/assets","files":"**/*.(s(c|a)ss|css)","allowEmptyInput":true,"configFile":"/config/stylelint.config.js"}, WebpackBarPlugin: {"name":"webpack","color":"green","reporters":["basic"],"reporter":null}, CleanExtractedDeps: {}, + WebpackRemoveEmptyScriptsPlugin: {"verbose":false,"extensions":["css","scss","sass","less","styl"],"scriptExtensions":["js","mjs"],"ignore":[]}, ], "resolve": Object { "alias": Object { @@ -1281,6 +1287,7 @@ Object { WebpackBarPlugin: {"name":"webpack","color":"green","reporters":["basic"],"reporter":null}, DependencyExtractionWebpackPlugin: {"combineAssets":false,"combinedOutputFile":null,"injectPolyfill":true,"outputFormat":"php","useDefaults":true}, CleanExtractedDeps: {}, + WebpackRemoveEmptyScriptsPlugin: {"verbose":false,"extensions":["css","scss","sass","less","styl"],"scriptExtensions":["js","mjs"],"ignore":[]}, ], "resolve": Object { "alias": Object {