From 994ad44efedc8d87326bed0323b29c3605401416 Mon Sep 17 00:00:00 2001 From: orhoj Date: Fri, 3 Dec 2021 11:25:36 +0100 Subject: [PATCH] Fix errors and resolve warnings --- .gitignore | 1 + app/app-dev.html | 2 +- configs/webpack.config.preload.dev.js | 2 +- configs/webpack.config.preload.prod.js | 3 ++ configs/webpack.config.renderer.dev.js | 51 ++---------------------- configs/webpack.config.renderer.prod.js | 13 ++----- package.json | 4 +- yarn.lock | 52 ++++--------------------- 8 files changed, 22 insertions(+), 106 deletions(-) diff --git a/.gitignore b/.gitignore index e0d1a1723..c503dfa76 100644 --- a/.gitignore +++ b/.gitignore @@ -49,6 +49,7 @@ storybook-static app/1.preload.dev.worker.js app/crypto.wasm app/preload.dev.worker.js +app/pkg_index_js.preload.dev.worker.js .idea npm-debug.log.* diff --git a/app/app-dev.html b/app/app-dev.html index 62612ac77..9797fe882 100644 --- a/app/app-dev.html +++ b/app/app-dev.html @@ -25,7 +25,7 @@ scripts.push('../dll/renderer.dev.dll.js'); // Dynamically insert the bundled app script in the renderer process const port = 1212; - scripts.push(`http://localhost:${port}/renderer.dev.js`); + scripts.push(`http://localhost:${port}/dist/renderer.dev.js`); if (scripts.length) { document.write( scripts diff --git a/configs/webpack.config.preload.dev.js b/configs/webpack.config.preload.dev.js index ce963168e..9d177cf91 100644 --- a/configs/webpack.config.preload.dev.js +++ b/configs/webpack.config.preload.dev.js @@ -10,7 +10,7 @@ CheckNodeEnv('development'); DeleteSourceMaps(); module.exports = merge(baseConfig, assetsConfig, stylesConfig(true), { - mode: 'production', + mode: 'development', target: 'electron-main', entry: [ 'core-js', diff --git a/configs/webpack.config.preload.prod.js b/configs/webpack.config.preload.prod.js index 89828b4dc..ab82d9b4c 100644 --- a/configs/webpack.config.preload.prod.js +++ b/configs/webpack.config.preload.prod.js @@ -16,6 +16,9 @@ module.exports = merge(baseConfig, assetsConfig, stylesConfig(true), { 'regenerator-runtime/runtime', fromRoot('./app/preload/preload.ts'), ], + experiments: { + syncWebAssembly: true, + }, output: { path: fromRoot('./app/dist'), publicPath: './dist/', diff --git a/configs/webpack.config.renderer.dev.js b/configs/webpack.config.renderer.dev.js index d1fa44e01..507002b2f 100644 --- a/configs/webpack.config.renderer.dev.js +++ b/configs/webpack.config.renderer.dev.js @@ -23,7 +23,7 @@ if (process.env.NODE_ENV === 'production') { } const port = process.env.PORT || 1212; -const publicPath = `http://localhost:${port}/dist`; +const publicPath = `http://localhost:${port}/dist/`; const dll = fromRoot('./dll'); const manifest = path.resolve(dll, 'renderer.json'); const requiredByDLLConfig = module.parent.filename.includes( @@ -52,14 +52,13 @@ module.exports = merge(baseConfig, assetsConfig, stylesConfig(false), { entry: [ 'core-js', 'regenerator-runtime/runtime', - ...(process.env.PLAIN_HMR ? [] : ['react-hot-loader/patch']), `webpack-dev-server/client?http://localhost:${port}/`, 'webpack/hot/only-dev-server', require.resolve('../app/index.tsx'), ], output: { - publicPath: '/', + publicPath, filename: 'renderer.dev.js', library: { type: 'umd', @@ -74,31 +73,6 @@ module.exports = merge(baseConfig, assetsConfig, stylesConfig(false), { alias: { 'react-dom': '@hot-loader/react-dom', }, - fallback: { - assert: require.resolve('assert'), - buffer: require.resolve('buffer'), - console: require.resolve('console-browserify'), - constants: require.resolve('constants-browserify'), - crypto: require.resolve('crypto-browserify'), - domain: require.resolve('domain-browser'), - events: require.resolve('events'), - http: require.resolve('stream-http'), - https: require.resolve('https-browserify'), - os: require.resolve('os-browserify/browser'), - path: require.resolve('path-browserify'), - punycode: require.resolve('punycode'), - // process: require.resolve('process/browser'), - querystring: require.resolve('querystring-es3'), - stream: require.resolve('stream-browserify'), - string_decoder: require.resolve('string_decoder'), - sys: require.resolve('util'), - timers: require.resolve('timers-browserify'), - tty: require.resolve('tty-browserify'), - url: require.resolve('url'), - util: require.resolve('util'), - vm: require.resolve('vm-browserify'), - zlib: require.resolve('browserify-zlib'), - }, }, optimization: { emitOnErrors: false, @@ -116,18 +90,6 @@ module.exports = merge(baseConfig, assetsConfig, stylesConfig(false), { Buffer: ['buffer/', 'Buffer'], }), - /** - * Create global constants which can be configured at compile time. - * - * Useful for allowing different behaviour between development builds and - * release builds - * - * NODE_ENV should be production so that modules do not perform certain - * development checks - * - * By default, use 'development' as NODE_ENV. This can be overriden with - * 'staging', for example, by changing the ENV variables in the npm scripts - */ new webpack.EnvironmentPlugin({ NODE_ENV: 'development', }), @@ -148,14 +110,7 @@ module.exports = merge(baseConfig, assetsConfig, stylesConfig(false), { hot: true, headers: { 'Access-Control-Allow-Origin': '*' }, static: { - // directory: path.join(__dirname, 'dist'), - // watch: true, - publicPath: '/', - // watchOptions: { - // aggregateTimeout: 300, - // ignored: /node_modules/, - // poll: 100, - // }, + publicPath, }, historyApiFallback: { verbose: true, diff --git a/configs/webpack.config.renderer.prod.js b/configs/webpack.config.renderer.prod.js index f90016c8c..9d2de160f 100644 --- a/configs/webpack.config.renderer.prod.js +++ b/configs/webpack.config.renderer.prod.js @@ -59,16 +59,11 @@ module.exports = merge(baseConfig, assetsConfig, stylesConfig(true), { ], }, + experiments: { + syncWebAssembly: true, + }, + plugins: [ - /** - * Create global constants which can be configured at compile time. - * - * Useful for allowing different behaviour between development builds and - * release builds - * - * NODE_ENV should be production so that modules do not perform certain - * development checks - */ new webpack.EnvironmentPlugin({ NODE_ENV: 'production', DEBUG_PROD: false, diff --git a/package.json b/package.json index bdd276414..2cb1c21fb 100644 --- a/package.json +++ b/package.json @@ -216,7 +216,7 @@ "jest": "^26.6.3", "knex": "0.95.5", "lint-staged": "^10.2.11", - "mini-css-extract-plugin": "^0.9.0", + "mini-css-extract-plugin": "^2.4.5", "node-sass": "^4.14.1", "opencollective-postinstall": "^2.0.3", "optimize-css-assets-webpack-plugin": "^5.0.3", @@ -244,7 +244,7 @@ "webpack": "^5.64.4", "webpack-bundle-analyzer": "^3.8.0", "webpack-cli": "^4.9.1", - "webpack-dev-server": "^4.6.0", + "webpack-dev-server": "4.6.0", "webpack-merge": "^5.0.9", "worker-loader": "^3.0.6", "yargs": "^17.1.1" diff --git a/yarn.lock b/yarn.lock index 4c64a475d..a6da8a981 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11853,7 +11853,7 @@ is-path-inside@^3.0.2: resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ== -is-plain-obj@^1.0.0, is-plain-obj@^1.1.0: +is-plain-obj@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" integrity sha1-caUMhCnfync8kqOQpKA7OfzVHT4= @@ -13751,15 +13751,12 @@ mini-create-react-context@^0.4.0: "@babel/runtime" "^7.12.1" tiny-warning "^1.0.3" -mini-css-extract-plugin@^0.9.0: - version "0.9.0" - resolved "https://registry.yarnpkg.com/mini-css-extract-plugin/-/mini-css-extract-plugin-0.9.0.tgz#47f2cf07aa165ab35733b1fc97d4c46c0564339e" - integrity sha512-lp3GeY7ygcgAmVIcRPBVhIkf8Us7FZjA+ILpal44qLdSu11wmjKQ3d9k15lfD7pO4esu9eUIAW7qiYIBppv40A== +mini-css-extract-plugin@^2.4.5: + version "2.4.5" + resolved "https://registry.yarnpkg.com/mini-css-extract-plugin/-/mini-css-extract-plugin-2.4.5.tgz#191d6c170226037212c483af1180b4010b7b9eef" + integrity sha512-oEIhRucyn1JbT/1tU2BhnwO6ft1jjH1iCX9Gc59WFMg0n5773rQU0oyQ0zzeYFFuBfONaRbQJyGoPtuNseMxjA== dependencies: - loader-utils "^1.1.0" - normalize-url "1.9.1" - schema-utils "^1.0.0" - webpack-sources "^1.1.0" + schema-utils "^4.0.0" minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: version "1.0.1" @@ -14322,16 +14319,6 @@ normalize-selector@^0.2.0: resolved "https://registry.yarnpkg.com/normalize-selector/-/normalize-selector-0.2.0.tgz#d0b145eb691189c63a78d201dc4fdb1293ef0c03" integrity sha1-0LFF62kRicY6eNIB3E/bEpPvDAM= -normalize-url@1.9.1: - version "1.9.1" - resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-1.9.1.tgz#2cc0d66b31ea23036458436e3620d85954c66c3c" - integrity sha1-LMDWazHqIwNkWENuNiDYWVTGbDw= - dependencies: - object-assign "^4.0.1" - prepend-http "^1.0.0" - query-string "^4.1.0" - sort-keys "^1.0.0" - normalize-url@^3.0.0: version "3.3.0" resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-3.3.0.tgz#b2e1c4dc4f7c6d57743df733a4f5978d18650559" @@ -15671,11 +15658,6 @@ prelude-ls@~1.1.2: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= -prepend-http@^1.0.0: - version "1.0.4" - resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc" - integrity sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw= - prepend-http@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897" @@ -15959,14 +15941,6 @@ qs@~6.5.2: resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== -query-string@^4.1.0: - version "4.3.4" - resolved "https://registry.yarnpkg.com/query-string/-/query-string-4.3.4.tgz#bbb693b9ca915c232515b228b1a02b609043dbeb" - integrity sha1-u7aTucqRXCMlFbIosaArYJBD2+s= - dependencies: - object-assign "^4.1.0" - strict-uri-encode "^1.0.0" - querystring-es3@^0.2.0, querystring-es3@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/querystring-es3/-/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73" @@ -17616,13 +17590,6 @@ sockjs@^0.3.21: uuid "^3.4.0" websocket-driver "^0.7.4" -sort-keys@^1.0.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/sort-keys/-/sort-keys-1.1.2.tgz#441b6d4d346798f1b4e49e8920adfba0e543f9ad" - integrity sha1-RBttTTRnmPG05J6JIK37oOVD+a0= - dependencies: - is-plain-obj "^1.0.0" - source-list-map@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.1.tgz#3993bd873bfc48479cca9ea3a547835c7c154b34" @@ -17927,11 +17894,6 @@ stream-shift@^1.0.0: resolved "https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.1.tgz#d7088281559ab2778424279b0877da3c392d5a3d" integrity sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ== -strict-uri-encode@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713" - integrity sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM= - string-argv@0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.1.tgz#95e2fbec0427ae19184935f816d74aaa4c5c19da" @@ -19909,7 +19871,7 @@ webpack-dev-middleware@^5.2.1: range-parser "^1.2.1" schema-utils "^4.0.0" -webpack-dev-server@^4.6.0: +webpack-dev-server@4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/webpack-dev-server/-/webpack-dev-server-4.6.0.tgz#e8648601c440172d9b6f248d28db98bed335315a" integrity sha512-oojcBIKvx3Ya7qs1/AVWHDgmP1Xml8rGsEBnSobxU/UJSX1xP1GPM3MwsAnDzvqcVmVki8tV7lbcsjEjk0PtYg==