From b497faeaac70f656b127ee01d8f61780bbb8384e Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Wed, 21 Nov 2018 00:58:22 -0500 Subject: [PATCH] Updates to latest webpack Enables source maps always Minifies css Removes unused plugins --- package-lock.json | 242 ++---------------------------------------------------- package.json | 8 +- webpack.config.js | 39 ++------- 3 files changed, 17 insertions(+), 272 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8c9c1f3..f676c70 100644 --- a/package-lock.json +++ b/package-lock.json @@ -48,9 +48,9 @@ } }, "@types/node": { - "version": "8.10.37", - "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.37.tgz", - "integrity": "sha512-Jp39foY8Euv/PG4OGPyzxis82mnjcUtXLEMA8oFMCE4ilmuJgZPdV2nZNV1moz+99EJTtcpOSgDCgATUwABKig==", + "version": "8.10.38", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.38.tgz", + "integrity": "sha512-EibsnbJerd0hBFaDjJStFrVbVBAtOy4dgL8zZFw0uOvPqzBAX59Ci8cgjg3+RgJIWhsB5A4c+pi+D4P9tQQh/A==", "dev": true }, "@webassemblyjs/ast": { @@ -2149,16 +2149,6 @@ "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", "dev": true }, - "deep-scope-analyser": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/deep-scope-analyser/-/deep-scope-analyser-1.6.0.tgz", - "integrity": "sha512-f1PMpb9p5j8TVrfsuVGCeQtGD2+2TuFrpzFOxbrs1sfqeAST93JoYjTE9Da0XpwQ2oH4fHpKUdmHtxNUjyJ5cQ==", - "dev": true, - "requires": { - "esrecurse": "^4.2.1", - "estraverse": "^4.2.0" - } - }, "define-properties": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", @@ -4446,16 +4436,6 @@ "glogg": "^1.0.0" } }, - "gzip-size": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-5.0.0.tgz", - "integrity": "sha512-5iI7omclyqrnWw4XbXAmGhPsABkSIDQonv2K0h61lybgofWa6iZyvrI3r2zsJH4P8Nb64fFVzlvfhs0g7BBxAA==", - "dev": true, - "requires": { - "duplexer": "^0.1.1", - "pify": "^3.0.0" - } - }, "har-schema": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", @@ -8154,12 +8134,6 @@ } } }, - "pretty-bytes": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.1.0.tgz", - "integrity": "sha512-wa5+qGVg9Yt7PB6rYm3kXlKzgzgivYTLRandezh43jjRqgyDyP+9YxfJpJiLs9yKD1WeU8/OvtToWpW7255FtA==", - "dev": true - }, "pretty-error": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/pretty-error/-/pretty-error-2.1.1.tgz", @@ -9225,52 +9199,6 @@ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" }, - "size-plugin": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/size-plugin/-/size-plugin-1.0.1.tgz", - "integrity": "sha512-3xcHO7eDxwCe/9hGMqEwjjmSUq/lfGIBHN9IL9hAw6TZeNtpzafmbj/llJUMhNrQ2SNJ+NNksYjkpMkecOlYvA==", - "dev": true, - "requires": { - "chalk": "^2.4.1", - "escape-string-regexp": "^1.0.5", - "glob": "^7.1.2", - "gzip-size": "^5.0.0", - "minimatch": "^3.0.4", - "pretty-bytes": "^5.1.0", - "util.promisify": "^1.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", - "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, "slash": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", @@ -10611,153 +10539,6 @@ "source-map": "~0.6.1" } }, - "uglifyjs-webpack-plugin": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-1.3.0.tgz", - "integrity": "sha512-ovHIch0AMlxjD/97j9AYovZxG5wnHOPkL7T1GKochBADp/Zwc44pEWNqpKl1Loupp1WhFg7SlYmHZRUfdAacgw==", - "dev": true, - "requires": { - "cacache": "^10.0.4", - "find-cache-dir": "^1.0.0", - "schema-utils": "^0.4.5", - "serialize-javascript": "^1.4.0", - "source-map": "^0.6.1", - "uglify-es": "^3.3.4", - "webpack-sources": "^1.1.0", - "worker-farm": "^1.5.2" - }, - "dependencies": { - "cacache": { - "version": "10.0.4", - "resolved": "http://registry.npmjs.org/cacache/-/cacache-10.0.4.tgz", - "integrity": "sha512-Dph0MzuH+rTQzGPNT9fAnrPmMmjKfST6trxJeK7NQuHRaVw24VzPRWTmg9MpcwOVQZO0E1FBICUlFeNaKPIfHA==", - "dev": true, - "requires": { - "bluebird": "^3.5.1", - "chownr": "^1.0.1", - "glob": "^7.1.2", - "graceful-fs": "^4.1.11", - "lru-cache": "^4.1.1", - "mississippi": "^2.0.0", - "mkdirp": "^0.5.1", - "move-concurrently": "^1.0.1", - "promise-inflight": "^1.0.1", - "rimraf": "^2.6.2", - "ssri": "^5.2.4", - "unique-filename": "^1.1.0", - "y18n": "^4.0.0" - } - }, - "commander": { - "version": "2.13.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.13.0.tgz", - "integrity": "sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA==", - "dev": true - }, - "find-cache-dir": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-1.0.0.tgz", - "integrity": "sha1-kojj6ePMN0hxfTnq3hfPcfww7m8=", - "dev": true, - "requires": { - "commondir": "^1.0.1", - "make-dir": "^1.0.0", - "pkg-dir": "^2.0.0" - } - }, - "find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", - "dev": true, - "requires": { - "locate-path": "^2.0.0" - } - }, - "mississippi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/mississippi/-/mississippi-2.0.0.tgz", - "integrity": "sha512-zHo8v+otD1J10j/tC+VNoGK9keCuByhKovAvdn74dmxJl9+mWHnx6EMsDN4lgRoMI/eYo2nchAxniIbUPb5onw==", - "dev": true, - "requires": { - "concat-stream": "^1.5.0", - "duplexify": "^3.4.2", - "end-of-stream": "^1.1.0", - "flush-write-stream": "^1.0.0", - "from2": "^2.1.0", - "parallel-transform": "^1.1.0", - "pump": "^2.0.1", - "pumpify": "^1.3.3", - "stream-each": "^1.1.0", - "through2": "^2.0.0" - } - }, - "pkg-dir": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", - "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", - "dev": true, - "requires": { - "find-up": "^2.1.0" - } - }, - "pump": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz", - "integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==", - "dev": true, - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, - "schema-utils": { - "version": "0.4.7", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.7.tgz", - "integrity": "sha512-v/iwU6wvwGK8HbU9yi3/nhGzP0yGSuhQMzL6ySiec1FSrZZDkhm4noOSWzrNFo/jEc+SJY6jRTwuwbSXJPDUnQ==", - "dev": true, - "requires": { - "ajv": "^6.1.0", - "ajv-keywords": "^3.1.0" - } - }, - "ssri": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/ssri/-/ssri-5.3.0.tgz", - "integrity": "sha512-XRSIPqLij52MtgoQavH/x/dU1qVKtWUAAZeOHsR9c2Ddi4XerFy3mc1alf+dLJKl9EUIm/Ht+EowFkTUOA6GAQ==", - "dev": true, - "requires": { - "safe-buffer": "^5.1.1" - } - }, - "through2": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", - "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", - "dev": true, - "requires": { - "readable-stream": "~2.3.6", - "xtend": "~4.0.1" - } - }, - "uglify-es": { - "version": "3.3.9", - "resolved": "https://registry.npmjs.org/uglify-es/-/uglify-es-3.3.9.tgz", - "integrity": "sha512-r+MU0rfv4L/0eeW3xZrd16t4NZfK8Ld4SWVglYBb7ez5uXFWHuVRs6xCTrf1yirs9a4j4Y27nn7SRfO6v67XsQ==", - "dev": true, - "requires": { - "commander": "~2.13.0", - "source-map": "~0.6.1" - } - }, - "y18n": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", - "dev": true - } - } - }, "unbzip2-stream": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.3.1.tgz", @@ -11626,9 +11407,9 @@ } }, "webpack": { - "version": "4.25.1", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-4.25.1.tgz", - "integrity": "sha512-T0GU/3NRtO4tMfNzsvpdhUr8HnzA4LTdP2zd+e5zd6CdOH5vNKHnAlO+DvzccfhPdzqRrALOFcjYxx7K5DWmvA==", + "version": "4.26.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-4.26.0.tgz", + "integrity": "sha512-J/dP9SJIc5OtX2FZ/+U9ikQtd6H6Mcbqt0xeXtmPwYGDKf8nkbOQQA9KL2Y0rJOsN1Al9Pdn+/j63X58ub8gvQ==", "dev": true, "requires": { "@webassemblyjs/ast": "1.7.11", @@ -11652,7 +11433,7 @@ "node-libs-browser": "^2.0.0", "schema-utils": "^0.4.4", "tapable": "^1.1.0", - "uglifyjs-webpack-plugin": "^1.2.4", + "terser-webpack-plugin": "^1.1.0", "watchpack": "^1.5.0", "webpack-sources": "^1.3.0" }, @@ -12198,15 +11979,6 @@ } } }, - "webpack-deep-scope-plugin": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/webpack-deep-scope-plugin/-/webpack-deep-scope-plugin-1.6.0.tgz", - "integrity": "sha512-ZYldKNeWQtk9SoV70x7Eb2NRmvHMtNBOjscs0wUdg/pfymntiF+0W/D9v2o76ztufjND6RNFjNVnyFQww25AZg==", - "dev": true, - "requires": { - "deep-scope-analyser": "^1.6.0" - } - }, "webpack-sources": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.3.0.tgz", diff --git a/package.json b/package.json index 05ff6f7..829823a 100644 --- a/package.json +++ b/package.json @@ -4392,7 +4392,7 @@ "devDependencies": { "@types/clipboardy": "1.1.0", "@types/lodash-es": "4.17.1", - "@types/node": "8.10.37", + "@types/node": "8.10.38", "clean-webpack-plugin": "1.0.0", "css-loader": "1.0.1", "filemanager-webpack-plugin": "2.0.5", @@ -4404,7 +4404,6 @@ "prettier": "1.15.2", "prettier-tslint": "0.4.0", "sass-loader": "7.1.0", - "size-plugin": "1.0.1", "terser-webpack-plugin": "1.1.0", "tslint": "5.11.0", "tslint-loader": "3.5.4", @@ -4413,8 +4412,7 @@ "typescript": "3.1.6", "vsce": "1.53.0", "vscode": "1.1.21", - "webpack": "4.25.1", - "webpack-cli": "3.1.2", - "webpack-deep-scope-plugin": "1.6.0" + "webpack": "4.26.0", + "webpack-cli": "3.1.2" } } diff --git a/webpack.config.js b/webpack.config.js index e9c351d..90140c0 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -9,9 +9,7 @@ const HtmlInlineSourcePlugin = require('html-webpack-inline-source-plugin'); const HtmlPlugin = require('html-webpack-plugin'); const ImageminPlugin = require('imagemin-webpack-plugin').default; const MiniCssExtractPlugin = require('mini-css-extract-plugin'); -// const SizePlugin = require('size-plugin'); const TerserPlugin = require('terser-webpack-plugin'); -// const WebpackDeepScopeAnalysisPlugin = require('webpack-deep-scope-plugin').default; module.exports = function(env, argv) { env = env || {}; @@ -36,12 +34,7 @@ function getExtensionConfig(env) { clean.push('fallbacks'); } - const plugins = [ - // https://github.com/GoogleChromeLabs/size-plugin/issues/12 - // new SizePlugin(), - new CleanPlugin(clean, { verbose: false }), - new webpack.IgnorePlugin(/^spawn-sync$/) - ]; + const plugins = [new CleanPlugin(clean, { verbose: false }), new webpack.IgnorePlugin(/^spawn-sync$/)]; if (env.copyClipboardyFallbacks) { plugins.push( @@ -61,10 +54,6 @@ function getExtensionConfig(env) { ); } - // if (env.production) { - // plugins.push(new WebpackDeepScopeAnalysisPlugin()); - // } - return { name: 'extension', entry: './src/extension.ts', @@ -73,7 +62,7 @@ function getExtensionConfig(env) { node: { __dirname: false }, - devtool: !env.production ? 'source-map' : undefined, + devtool: 'source-map', //!env.production ? 'source-map' : undefined, output: { libraryTarget: 'commonjs2', filename: 'extension.js', @@ -84,7 +73,7 @@ function getExtensionConfig(env) { new TerserPlugin({ cache: true, parallel: true, - sourceMap: env.production, + sourceMap: true, // !env.production, terserOptions: { ecma: 8, // Keep the class names otherwise @log won't provide a useful name @@ -136,8 +125,6 @@ function getUIConfig(env) { } const plugins = [ - // https://github.com/GoogleChromeLabs/size-plugin/issues/12 - // new SizePlugin(), new CleanPlugin(clean, { verbose: false }), new MiniCssExtractPlugin({ filename: '[name].css' @@ -149,7 +136,6 @@ function getUIConfig(env) { filename: path.resolve(__dirname, 'settings.html'), inject: true, inlineSource: env.production ? '.(js|css)$' : undefined, - // inlineSource: '.(js|css)$', minify: env.production ? { removeComments: true, @@ -158,7 +144,8 @@ function getUIConfig(env) { useShortDoctype: true, removeEmptyAttributes: true, removeStyleLinkTypeAttributes: true, - keepClosingSlash: true + keepClosingSlash: true, + minifyCSS: true } : false }), @@ -169,7 +156,6 @@ function getUIConfig(env) { filename: path.resolve(__dirname, 'welcome.html'), inject: true, inlineSource: env.production ? '.(js|css)$' : undefined, - // inlineSource: '.(js|css)$', minify: env.production ? { removeComments: true, @@ -178,7 +164,8 @@ function getUIConfig(env) { useShortDoctype: true, removeEmptyAttributes: true, removeStyleLinkTypeAttributes: true, - keepClosingSlash: true + keepClosingSlash: true, + minifyCSS: true } : false }), @@ -202,10 +189,6 @@ function getUIConfig(env) { }) ]; - // if (env.production) { - // plugins.push(new WebpackDeepScopeAnalysisPlugin()); - // } - return { name: 'ui', context: path.resolve(__dirname, 'src/ui'), @@ -223,13 +206,6 @@ function getUIConfig(env) { publicPath: '{{root}}/dist/ui/' }, optimization: { - minimizer: [ - new TerserPlugin({ - cache: true, - parallel: true, - sourceMap: env.production - }) - ], splitChunks: { cacheGroups: { styles: { @@ -275,7 +251,6 @@ function getUIConfig(env) { { loader: 'css-loader', options: { - minimize: env.production, sourceMap: !env.production, url: false }