From fabd81ba0bea070f09c5ed71ddfe57c943274dd6 Mon Sep 17 00:00:00 2001 From: Bradley Maier Date: Tue, 9 Jun 2020 08:23:06 -0700 Subject: [PATCH 1/2] Add hard source webpack plugin in experimental speed mode --- package-lock.json | 140 +++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + src/base.config.ts | 18 ++++++ 3 files changed, 159 insertions(+) diff --git a/package-lock.json b/package-lock.json index dbae547b..53937f3a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7345,6 +7345,103 @@ "har-schema": "^2.0.0" } }, + "hard-source-webpack-plugin": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/hard-source-webpack-plugin/-/hard-source-webpack-plugin-0.13.1.tgz", + "integrity": "sha512-r9zf5Wq7IqJHdVAQsZ4OP+dcUSvoHqDMxJlIzaE2J0TZWn3UjMMrHqwDHR8Jr/pzPfG7XxSe36E7Y8QGNdtuAw==", + "requires": { + "chalk": "^2.4.1", + "find-cache-dir": "^2.0.0", + "graceful-fs": "^4.1.11", + "lodash": "^4.15.0", + "mkdirp": "^0.5.1", + "node-object-hash": "^1.2.0", + "parse-json": "^4.0.0", + "pkg-dir": "^3.0.0", + "rimraf": "^2.6.2", + "semver": "^5.6.0", + "tapable": "^1.0.0-beta.5", + "webpack-sources": "^1.0.1", + "write-json-file": "^2.3.0" + }, + "dependencies": { + "find-cache-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.1.0.tgz", + "integrity": "sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ==", + "requires": { + "commondir": "^1.0.1", + "make-dir": "^2.0.0", + "pkg-dir": "^3.0.0" + } + }, + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "requires": { + "locate-path": "^3.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "make-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", + "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", + "requires": { + "pify": "^4.0.1", + "semver": "^5.6.0" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" + }, + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==" + }, + "pkg-dir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz", + "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", + "requires": { + "find-up": "^3.0.0" + } + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + } + } + }, "has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -10877,6 +10974,11 @@ } } }, + "node-object-hash": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/node-object-hash/-/node-object-hash-1.4.2.tgz", + "integrity": "sha512-UdS4swXs85fCGWWf6t6DMGgpN/vnlKeSGEQ7hJcrs7PBFoxoKLmibc3QRb7fwiYsjdL7PX8iI/TMSlZ90dgHhQ==" + }, "node-releases": { "version": "1.1.57", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.57.tgz", @@ -17669,6 +17771,44 @@ "slide": "^1.1.5" } }, + "write-json-file": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/write-json-file/-/write-json-file-2.3.0.tgz", + "integrity": "sha1-K2TIozAE1UuGmMdtWFp3zrYdoy8=", + "requires": { + "detect-indent": "^5.0.0", + "graceful-fs": "^4.1.2", + "make-dir": "^1.0.0", + "pify": "^3.0.0", + "sort-keys": "^2.0.0", + "write-file-atomic": "^2.0.0" + }, + "dependencies": { + "detect-indent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-5.0.0.tgz", + "integrity": "sha1-OHHMCmoALow+Wzz38zYmRnXwa50=" + }, + "sort-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-2.0.0.tgz", + "integrity": "sha1-ZYU1WEhh7JfXMNbPQYIuH1ZoQSg=", + "requires": { + "is-plain-obj": "^1.0.0" + } + }, + "write-file-atomic": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.4.3.tgz", + "integrity": "sha512-GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ==", + "requires": { + "graceful-fs": "^4.1.11", + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.2" + } + } + } + }, "ws": { "version": "7.3.0", "resolved": "https://registry.npmjs.org/ws/-/ws-7.3.0.tgz", diff --git a/package.json b/package.json index a2138d3c..453c1442 100644 --- a/package.json +++ b/package.json @@ -122,6 +122,7 @@ "file-loader": "2.0.0", "globby": "7.1.1", "gzip-size": "4.1.0", + "hard-source-webpack-plugin": "0.13.1", "html-loader": "0.5.5", "html-webpack-plugin": "3.2.0", "http-proxy-middleware": "^0.19.0", diff --git a/src/base.config.ts b/src/base.config.ts index 9ec057dd..07aa5474 100644 --- a/src/base.config.ts +++ b/src/base.config.ts @@ -22,6 +22,7 @@ const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin'); const ExtraWatchWebpackPlugin = require('extra-watch-webpack-plugin'); const createHash = require('webpack/lib/util/createHash'); const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); +const HardSourceWebpackPlugin = require('hard-source-webpack-plugin'); const stylelint = require('stylelint'); const StyleLintPlugin = require('stylelint-webpack-plugin'); @@ -457,6 +458,23 @@ export default function webpackConfigFactory(args: any): webpack.Configuration { devtool: 'source-map', watchOptions: { ignored: /node_modules/ }, plugins: removeEmpty([ + isExperimentalSpeed && + new HardSourceWebpackPlugin({ + info: { + level: 'warn' + } + }), + isExperimentalSpeed && + new HardSourceWebpackPlugin.ExcludeModulePlugin([ + { + // HardSource works with mini-css-extract-plugin but due to how + // mini-css emits assets, assets are not emitted on repeated builds with + // mini-css and hard-source together. Ignoring the mini-css loader + // modules, but not the other css loader modules, excludes the modules + // that mini-css needs rebuilt to output assets every time. + test: /mini-css-extract-plugin[\\/]dist[\\/]loader/ + } + ]), new StyleLintPlugin({ config: { rules: { From 67e53eed6d2def454d312ed017e9aab1510dec33 Mon Sep 17 00:00:00 2001 From: Bradley Maier Date: Tue, 9 Jun 2020 08:51:34 -0700 Subject: [PATCH 2/2] Try again