From 0f47074e14524583f17e904a1bd1d41ad80a5b96 Mon Sep 17 00:00:00 2001 From: Chris Vickery Date: Sun, 6 Oct 2019 14:10:45 -0700 Subject: [PATCH] Add sentry and fix potential minification bugs --- craco.config.js | 33 ++++++++++++++++------- package.json | 1 + yarn.lock | 72 +++++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 95 insertions(+), 11 deletions(-) diff --git a/craco.config.js b/craco.config.js index dcac439..9f23c70 100644 --- a/craco.config.js +++ b/craco.config.js @@ -1,17 +1,32 @@ const WorkerLoaderPlugin = require("craco-worker-loader"); +const SentryPlugin = require("craco-sentry-plugin"); module.exports = function({ env }) { + var plugins = [ + { + plugin: WorkerLoaderPlugin + } + ]; + if (env === "production") { + plugins.push({ + plugin: SentryPlugin + }); + } return { - plugins: [ - { - plugin: WorkerLoaderPlugin - } - ], + plugins: plugins, webpack: { - configure: { - output: { - globalObject: "this" - } + configure: (webpackConfig, { env, paths }) => { + webpackConfig.output.globalObject = "this"; + webpackConfig.optimization.minimizer = webpackConfig.optimization.minimizer.map( + function(plugin) { + if (plugin.constructor.name !== "TerserPlugin") { + return plugin; + } + plugin.options.terserOptions.keep_fnames = true; + return plugin; + } + ); + return webpackConfig; } } }; diff --git a/package.json b/package.json index 814301f..c2eec27 100644 --- a/package.json +++ b/package.json @@ -64,6 +64,7 @@ "@babel/preset-react": "^7.0.0", "babel-jest": "^24.9.0", "connect-history-api-fallback": "1.3.0", + "craco-sentry-plugin": "^1.0.0", "craco-worker-loader": "^1.0.0", "cross-spawn": "4.0.2", "detect-port": "1.1.0", diff --git a/yarn.lock b/yarn.lock index 617f5fe..3c5de00 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1223,6 +1223,25 @@ dependencies: any-observable "^0.3.0" +"@sentry/cli@^1.47.1": + version "1.47.2" + resolved "https://registry.yarnpkg.com/@sentry/cli/-/cli-1.47.2.tgz#75a23d2816300b333d4e34163c85feeef93bc062" + integrity sha512-bUJGyxZQzB8mqnCL3RoeLl169XleoLnn2a1w/xqc8IOBt70IEtpVQQ86jgpZfpY1HqPZlczqEkm1U5kfjCaqLw== + dependencies: + fs-copy-file-sync "^1.1.1" + https-proxy-agent "^2.2.1" + mkdirp "^0.5.1" + node-fetch "^2.1.2" + progress "2.0.0" + proxy-from-env "^1.0.0" + +"@sentry/webpack-plugin@^1.8.1": + version "1.8.1" + resolved "https://registry.yarnpkg.com/@sentry/webpack-plugin/-/webpack-plugin-1.8.1.tgz#26d8acc854b2545d6057b2bb83417e1f89df4cc1" + integrity sha512-Y1NUPOTXWJ3b15+0HTWbH44seGQBYS4rQiI9NqTGvnb2a7U02jKkS6iqdP3boQO8mzd/yPaXEHwgeZ+vxk5E+A== + dependencies: + "@sentry/cli" "^1.47.1" + "@svgr/babel-plugin-add-jsx-attribute@^4.2.0": version "4.2.0" resolved "https://registry.yarnpkg.com/@svgr/babel-plugin-add-jsx-attribute/-/babel-plugin-add-jsx-attribute-4.2.0.tgz#dadcb6218503532d6884b210e7f3c502caaa44b1" @@ -1739,6 +1758,13 @@ after@0.8.2: resolved "https://registry.yarnpkg.com/after/-/after-0.8.2.tgz#fedb394f9f0e02aa9768e702bda23b505fae7e1f" integrity sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8= +agent-base@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.3.0.tgz#8165f01c436009bccad0b1d122f05ed770efc6ee" + integrity sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg== + dependencies: + es6-promisify "^5.0.0" + aggregate-error@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-3.0.0.tgz#5b5a3c95e9095f311c9ab16c19fb4f3527cd3f79" @@ -3343,6 +3369,13 @@ cosmiconfig@^5.0.0, cosmiconfig@^5.2.0, cosmiconfig@^5.2.1: js-yaml "^3.13.1" parse-json "^4.0.0" +craco-sentry-plugin@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/craco-sentry-plugin/-/craco-sentry-plugin-1.0.0.tgz#90f7c19ba3a5bd6dd47784d5633a6f2a2eb21ef5" + integrity sha512-m5gl7dFh5DSvOpg3mezmx6KAQA6k9uPkVKEQhXPuuTJ5ghPD4YpL2dYdcw18gck7jrOMfWzkiDnePwrdhD5XGQ== + dependencies: + "@sentry/webpack-plugin" "^1.8.1" + craco-worker-loader@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/craco-worker-loader/-/craco-worker-loader-1.0.0.tgz#359fb231643fdf10daa36b3a59a7b2232f373277" @@ -3917,7 +3950,7 @@ debug@=3.1.0, debug@~3.1.0: dependencies: ms "2.0.0" -debug@^3.0.0, debug@^3.2.5, debug@^3.2.6: +debug@^3.0.0, debug@^3.1.0, debug@^3.2.5, debug@^3.2.6: version "3.2.6" resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== @@ -4565,6 +4598,18 @@ es6-promise-pool@^2.5.0: resolved "https://registry.yarnpkg.com/es6-promise-pool/-/es6-promise-pool-2.5.0.tgz#147c612b36b47f105027f9d2bf54a598a99d9ccb" integrity sha1-FHxhKza0fxBQJ/nSv1SlmKmdnMs= +es6-promise@^4.0.3: + version "4.2.8" + resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a" + integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w== + +es6-promisify@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-5.0.0.tgz#5109d62f3e56ea967c4b63505aef08291c8a5203" + integrity sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM= + dependencies: + es6-promise "^4.0.3" + es6-symbol@^3.1.1, es6-symbol@~3.1.1: version "3.1.2" resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.2.tgz#859fdd34f32e905ff06d752e7171ddd4444a7ed1" @@ -5416,6 +5461,11 @@ fs-constants@^1.0.0: resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad" integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow== +fs-copy-file-sync@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/fs-copy-file-sync/-/fs-copy-file-sync-1.1.1.tgz#11bf32c096c10d126e5f6b36d06eece776062918" + integrity sha512-2QY5eeqVv4m2PfyMiEuy9adxNP+ajf+8AR05cEi+OAzPcOj90hvFImeZhTmKLBgSd9EvG33jsD7ZRxsx9dThkQ== + fs-extra@7.0.1, fs-extra@^7.0.0: version "7.0.1" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" @@ -6105,6 +6155,14 @@ https-browserify@^1.0.0: resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73" integrity sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM= +https-proxy-agent@^2.2.1: + version "2.2.2" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.2.tgz#271ea8e90f836ac9f119daccd39c19ff7dfb0793" + integrity sha512-c8Ndjc9Bkpfx/vCJueCPy0jlP4ccCCSNDp8xwCZzPjKJUm+B+u9WX2x98Qx4n1PiMNTWo3D7KK5ifNV/yJyRzg== + dependencies: + agent-base "^4.3.0" + debug "^3.1.0" + humanize-url@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/humanize-url/-/humanize-url-1.0.1.tgz#f4ab99e0d288174ca4e1e50407c55fbae464efff" @@ -8387,7 +8445,7 @@ node-fetch@^1.0.1: encoding "^0.1.11" is-stream "^1.0.1" -node-fetch@^2.6.0: +node-fetch@^2.1.2, node-fetch@^2.6.0: version "2.6.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA== @@ -10104,6 +10162,11 @@ process@~0.5.1: resolved "https://registry.yarnpkg.com/process/-/process-0.5.2.tgz#1638d8a8e34c2f440a91db95ab9aeb677fc185cf" integrity sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8= +progress@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f" + integrity sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8= + progress@^2.0.0: version "2.0.3" resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" @@ -10162,6 +10225,11 @@ proxy-addr@~2.0.5: forwarded "~0.1.2" ipaddr.js "1.9.0" +proxy-from-env@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.0.0.tgz#33c50398f70ea7eb96d21f7b817630a55791c7ee" + integrity sha1-M8UDmPcOp+uW0h97gXYwpVeRx+4= + prr@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476"