diff --git a/public/react/.env b/public/react/.env new file mode 100644 index 000000000..4f79a0f8e --- /dev/null +++ b/public/react/.env @@ -0,0 +1 @@ +GENERATE_SOURCEMAP=false \ No newline at end of file diff --git a/public/react/.gitignore b/public/react/.gitignore index 4d29575de..2a5bc17a2 100644 --- a/public/react/.gitignore +++ b/public/react/.gitignore @@ -10,7 +10,7 @@ # production /build - +/dist # misc .DS_Store .env.local diff --git a/public/react/config-overrides.js b/public/react/config-overrides.js index 487fbfbbf..4a7362280 100644 --- a/public/react/config-overrides.js +++ b/public/react/config-overrides.js @@ -8,9 +8,54 @@ const { addWebpackPlugin } = require("customize-cra") + const path = require('path'); const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin') -const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin'); +const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin') +const HardSourceWebpackPlugin = require('hard-source-webpack-plugin') + +let instance = new HardSourceWebpackPlugin({ + // Either an absolute path or relative to webpack's options.context. + cacheDirectory: 'node_modules/.cache/hard-source/[confighash]', + // Either a string of object hash function given a webpack config. + configHash: function (webpackConfig) { + // node-object-hash on npm can be used to build this. + return require('node-object-hash')({ sort: false }).hash(webpackConfig); + }, + // Either false, a string, an object, or a project hashing function. + environmentHash: { + root: process.cwd(), + directories: [], + files: ['package-lock.json', 'yarn.lock'], + },// How to launch the extra processes. Default: + fork: (fork, compiler, webpackBin) => fork( + webpackBin(), + ['--config', __filename], { + silent: true, + } + ), + // Number of workers to spawn. Default: + numWorkers: () => require('os').cpus().length, + // Number of modules built before launching parallel building. Default: + minModules: 10, + // An object. + info: { + // 'none' or 'test'. + mode: 'none', + // 'debug', 'log', 'info', 'warn', or 'error'. + level: 'debug', + }, + // Clean up large, old caches automatically. + cachePrune: { + // Caches younger than `maxAge` are not considered for deletion. They must + // be at least this (default: 2 days) old in milliseconds. + maxAge: 2 * 24 * 60 * 60 * 1000, + // All caches together must be larger than `sizeThreshold` before any + // caches will be deleted. Together they must be at least this + // (default: 50 MB) big in bytes. + sizeThreshold: 50 * 1024 * 1024 + }, +}) module.exports = override( disableEsLint(), @@ -27,6 +72,7 @@ module.exports = override( style: true }), addWebpackPlugin(new MonacoWebpackPlugin({})), + addWebpackPlugin(instance), (config) => { config.resolve.plugins = config.resolve.plugins.filter(plugin => !(plugin instanceof ModuleScopePlugin)); if (process.env.NODE_ENV !== "development") { diff --git a/public/react/dist/report.html b/public/react/dist/report.html index 71f7c738f..a3257ae1f 100644 --- a/public/react/dist/report.html +++ b/public/react/dist/report.html @@ -3,7 +3,7 @@ - h5 [12 Mar 2020 at 9:45] + h5 [13 Mar 2020 at 16:15] diff --git a/public/react/package-lock.json b/public/react/package-lock.json index 94e32a7a7..10497cad9 100644 --- a/public/react/package-lock.json +++ b/public/react/package-lock.json @@ -4596,6 +4596,12 @@ "resolved": "http://registry.npm.taobao.org/destroy/download/destroy-1.0.4.tgz", "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" }, + "detect-indent": { + "version": "5.0.0", + "resolved": "https://registry.npm.taobao.org/detect-indent/download/detect-indent-5.0.0.tgz", + "integrity": "sha1-OHHMCmoALow+Wzz38zYmRnXwa50=", + "dev": true + }, "detect-newline": { "version": "2.1.0", "resolved": "https://registry.npm.taobao.org/detect-newline/download/detect-newline-2.1.0.tgz?cache=0&sync_timestamp=1573634824396&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fdetect-newline%2Fdownload%2Fdetect-newline-2.1.0.tgz", @@ -6568,6 +6574,55 @@ "har-schema": "^2.0.0" } }, + "hard-source-webpack-plugin": { + "version": "0.13.1", + "resolved": "https://registry.npm.taobao.org/hard-source-webpack-plugin/download/hard-source-webpack-plugin-0.13.1.tgz", + "integrity": "sha1-qZBx4lsjLxQ4pbw8mfEKOGnkQo4=", + "dev": true, + "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": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npm.taobao.org/chalk/download/chalk-2.4.2.tgz?cache=0&sync_timestamp=1573282918610&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fchalk%2Fdownload%2Fchalk-2.4.2.tgz", + "integrity": "sha1-zUJUFnelQzPPVBpJEIwUMrRMlCQ=", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npm.taobao.org/semver/download/semver-5.7.1.tgz", + "integrity": "sha1-qVT5Ma66UI0we78Gnv8MAclhFvc=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npm.taobao.org/supports-color/download/supports-color-5.5.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsupports-color%2Fdownload%2Fsupports-color-5.5.0.tgz", + "integrity": "sha1-4uaaRKyHcveKHsCzW2id9lMO/I8=", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, "harmony-reflect": { "version": "1.6.1", "resolved": "http://registry.npm.taobao.org/harmony-reflect/download/harmony-reflect-1.6.1.tgz", @@ -9910,6 +9965,12 @@ } } }, + "node-object-hash": { + "version": "1.4.2", + "resolved": "https://registry.npm.taobao.org/node-object-hash/download/node-object-hash-1.4.2.tgz", + "integrity": "sha1-OFgz2FsimQK3WCYiT2B3vpaanpQ=", + "dev": true + }, "node-releases": { "version": "1.1.49", "resolved": "https://registry.npm.taobao.org/node-releases/download/node-releases-1.1.49.tgz", @@ -17367,6 +17428,40 @@ "signal-exit": "^3.0.2" } }, + "write-json-file": { + "version": "2.3.0", + "resolved": "https://registry.npm.taobao.org/write-json-file/download/write-json-file-2.3.0.tgz?cache=0&sync_timestamp=1581076919274&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fwrite-json-file%2Fdownload%2Fwrite-json-file-2.3.0.tgz", + "integrity": "sha1-K2TIozAE1UuGmMdtWFp3zrYdoy8=", + "dev": true, + "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": { + "make-dir": { + "version": "1.3.0", + "resolved": "https://registry.npm.taobao.org/make-dir/download/make-dir-1.3.0.tgz", + "integrity": "sha1-ecEDO4BRW9bSTsmTPoYMp17ifww=", + "dev": true, + "requires": { + "pify": "^3.0.0" + } + }, + "sort-keys": { + "version": "2.0.0", + "resolved": "https://registry.npm.taobao.org/sort-keys/download/sort-keys-2.0.0.tgz?cache=0&sync_timestamp=1565864727994&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsort-keys%2Fdownload%2Fsort-keys-2.0.0.tgz", + "integrity": "sha1-ZYU1WEhh7JfXMNbPQYIuH1ZoQSg=", + "dev": true, + "requires": { + "is-plain-obj": "^1.0.0" + } + } + } + }, "ws": { "version": "5.2.2", "resolved": "https://registry.npm.taobao.org/ws/download/ws-5.2.2.tgz", diff --git a/public/react/package.json b/public/react/package.json index c2b6b9f0e..ead8e1909 100644 --- a/public/react/package.json +++ b/public/react/package.json @@ -80,6 +80,7 @@ "devDependencies": { "babel-plugin-import": "^1.13.0", "customize-cra": "^0.5.0", + "hard-source-webpack-plugin": "^0.13.1", "less": "^3.11.1", "less-loader": "^5.0.0", "react-app-rewired": "^2.1.5",