diff --git a/package.json b/package.json index 732c15a5..194c63a2 100644 --- a/package.json +++ b/package.json @@ -163,12 +163,9 @@ "vue-loader": "~17.1.2", "vue-router": "~4.5.1", "vuex": "^4.1.0", - "webpack": "~5.100.2", + "webpack": "^5.105.1", "webpack-cli": "^6.0.1", "webpack-dev-middleware": "^7.4.5", "webpack-hot-middleware": "^2.26.1" - }, - "resolutions": { - "socket.io-parser": "4.2.4" } } diff --git a/scripts/noop.js b/scripts/noop.mjs similarity index 53% rename from scripts/noop.js rename to scripts/noop.mjs index b9a29cec..9e40ba6a 100644 --- a/scripts/noop.js +++ b/scripts/noop.mjs @@ -1,5 +1,5 @@ "use strict"; -module.exports = function () { +export default function () { return function () {}; -}; +} diff --git a/server/plugins/dev-server.ts b/server/plugins/dev-server.ts index 7d215fa5..51aeef82 100644 --- a/server/plugins/dev-server.ts +++ b/server/plugins/dev-server.ts @@ -28,6 +28,10 @@ export default (app: express.Application) => { const compiler = webpack(webpackConfig); + if (!compiler) { + throw new Error("Webpack failed to create a compiler"); + } + app.use( // eslint-disable-next-line @typescript-eslint/no-misused-promises webpackDevMiddleware(compiler, { @@ -35,8 +39,7 @@ export default (app: express.Application) => { publicPath: webpackConfig.output?.publicPath, }) ).use( - // TODO: Fix compiler type - webpackHotMiddleware(compiler as any, { + webpackHotMiddleware(compiler, { path: "/storage/__webpack_hmr", }) ); diff --git a/webpack.config.ts b/webpack.config.ts index 02a7ca54..a8c2f1c4 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -41,6 +41,7 @@ const config: webpack.Configuration = { }, resolve: { extensions: [".ts", ".js", ".vue"], + conditionNames: ["import", "require", "default", "node"], }, module: { rules: [ @@ -167,11 +168,6 @@ const config: webpack.Configuration = { }, ], }), - // socket.io uses debug, we don't need it - new webpack.NormalModuleReplacementPlugin( - /debug/, - path.resolve(__dirname, "scripts/noop.js") - ), ], }; @@ -205,7 +201,7 @@ export default (env: any, argv: any) => { // Client tests that require Vue may end up requireing socket.io new webpack.NormalModuleReplacementPlugin( /js(\/|\\)socket\.js/, - path.resolve(__dirname, "scripts/noop.js") + path.resolve(__dirname, "scripts/noop.mjs") ), ]; } diff --git a/yarn.lock b/yarn.lock index 64b841ba..5ecb502d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3558,13 +3558,6 @@ debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.3, d dependencies: ms "^2.1.3" -debug@~4.3.1: - version "4.3.7" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52" - integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ== - dependencies: - ms "^2.1.3" - decamelize-keys@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/decamelize-keys/-/decamelize-keys-1.1.1.tgz#04a2d523b2f18d80d0158a43b895d56dff8d19d8" @@ -3826,7 +3819,7 @@ engine.io@~6.6.0: engine.io-parser "~5.2.1" ws "~8.18.3" -enhanced-resolve@^5.0.0, enhanced-resolve@^5.17.2, enhanced-resolve@^5.19.0: +enhanced-resolve@^5.0.0, enhanced-resolve@^5.19.0: version "5.19.0" resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.19.0.tgz#6687446a15e969eaa63c2fa2694510e17ae6d97c" integrity sha512-phv3E1Xl4tQOShqSte26C7Fl84EwUdZsyOuSSk9qtAGyyQs2s3jJzComh+Abf4g187lUUAvH+H26omrqia2aGg== @@ -3881,11 +3874,6 @@ es-errors@^1.3.0: resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== -es-module-lexer@^1.2.1: - version "1.7.0" - resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-1.7.0.tgz#9159601561880a85f2734560a9099b2c31e5372a" - integrity sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA== - es-module-lexer@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-2.0.0.tgz#f657cd7a9448dcdda9c070a3cb75e5dc1e85f5b1" @@ -5370,7 +5358,7 @@ linkify-it@^3.0.3: dependencies: uc.micro "^1.0.1" -loader-runner@^4.2.0, loader-runner@^4.3.1: +loader-runner@^4.3.1: version "4.3.1" resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-4.3.1.tgz#6c76ed29b0ccce9af379208299f07f876de737e3" integrity sha512-IWqP2SCPhyVFTBtRcgMHdzlf9ul25NwaFx4wCEH/KjAXuuHY4yNjvPXsBokp8jCB936PyWRaPKUNh8NvylLp2Q== @@ -7391,7 +7379,7 @@ schema-utils@^3.1.1: ajv "^6.12.5" ajv-keywords "^3.5.2" -schema-utils@^4.0.0, schema-utils@^4.2.0, schema-utils@^4.3.0, schema-utils@^4.3.2, schema-utils@^4.3.3: +schema-utils@^4.0.0, schema-utils@^4.2.0, schema-utils@^4.3.0, schema-utils@^4.3.3: version "4.3.3" resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-4.3.3.tgz#5b1850912fa31df90716963d45d9121fdfc09f46" integrity sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA== @@ -7622,13 +7610,13 @@ socket.io-client@^4.8.3: engine.io-client "~6.6.1" socket.io-parser "~4.2.4" -socket.io-parser@4.2.4, socket.io-parser@~4.2.4: - version "4.2.4" - resolved "https://registry.yarnpkg.com/socket.io-parser/-/socket.io-parser-4.2.4.tgz#c806966cf7270601e47469ddeec30fbdfda44c83" - integrity sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew== +socket.io-parser@~4.2.4: + version "4.2.5" + resolved "https://registry.yarnpkg.com/socket.io-parser/-/socket.io-parser-4.2.5.tgz#3f41b8d369129a93268f2abecba94b5292850099" + integrity sha512-bPMmpy/5WWKHea5Y/jYAP6k74A+hvmRCQaJuJB6I/ML5JZq/KfNieUVo/3Mh7SAqn7TyFdIo6wqYHInG1MU1bQ== dependencies: "@socket.io/component-emitter" "~3.1.0" - debug "~4.3.1" + debug "~4.4.1" socket.io@^4.8.3: version "4.8.3" @@ -7990,7 +7978,7 @@ table@^6.8.1: string-width "^4.2.3" strip-ansi "^6.0.1" -tapable@^2.1.1, tapable@^2.2.0, tapable@^2.2.1, tapable@^2.3.0: +tapable@^2.2.0, tapable@^2.2.1, tapable@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.3.0.tgz#7e3ea6d5ca31ba8e078b560f0d83ce9a14aa8be6" integrity sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg== @@ -8028,7 +8016,7 @@ tar@^6.0.2, tar@^6.1.11, tar@^6.1.2: mkdirp "^1.0.3" yallist "^4.0.0" -terser-webpack-plugin@^5.3.11, terser-webpack-plugin@^5.3.16: +terser-webpack-plugin@^5.3.16: version "5.3.16" resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.3.16.tgz#741e448cc3f93d8026ebe4f7ef9e4afacfd56330" integrity sha512-h9oBFCWrq78NyWWVcSwZarJkZ01c2AyGrzs1crmHZO3QUg9D61Wu4NPjBy69n7JqylFF5y+CsUZYmYEIZ3mR+Q== @@ -8472,7 +8460,7 @@ vuex@^4.1.0: dependencies: "@vue/devtools-api" "^6.0.0-beta.11" -watchpack@^2.4.0, watchpack@^2.4.1, watchpack@^2.5.1: +watchpack@^2.4.0, watchpack@^2.5.1: version "2.5.1" resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.5.1.tgz#dd38b601f669e0cbf567cb802e75cead82cde102" integrity sha512-Zn5uXdcFNIA1+1Ei5McRd+iRzfhENPCe7LeABkJtNulSxjma+l7ltNx55BWZkRlwRnpOgHqxnjyaDgJnNXnqzg== @@ -8545,7 +8533,7 @@ webpack-sources@^3.3.3: resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.3.3.tgz#d4bf7f9909675d7a070ff14d0ef2a4f3c982c723" integrity sha512-yd1RBzSGanHkitROoPFd6qsrxt+oFhg/129YzheDGqeustzX0vTZJZsSsQjVQC4yzBQ56K55XU8gaNCtIzOnTg== -webpack@^5: +webpack@^5, webpack@^5.105.1: version "5.105.1" resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.105.1.tgz#c05cb3621196c76fa3b3a9bea446d14616b83778" integrity sha512-Gdj3X74CLJJ8zy4URmK42W7wTZUJrqL+z8nyGEr4dTN0kb3nVs+ZvjbTOqRYPD7qX4tUmwyHL9Q9K6T1seW6Yw== @@ -8576,37 +8564,6 @@ webpack@^5: watchpack "^2.5.1" webpack-sources "^3.3.3" -webpack@~5.100.2: - version "5.100.2" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.100.2.tgz#e2341facf9f7de1d702147c91bcb65b693adf9e8" - integrity sha512-QaNKAvGCDRh3wW1dsDjeMdDXwZm2vqq3zn6Pvq4rHOEOGSaUMgOOjG2Y9ZbIGzpfkJk9ZYTHpDqgDfeBDcnLaw== - dependencies: - "@types/eslint-scope" "^3.7.7" - "@types/estree" "^1.0.8" - "@types/json-schema" "^7.0.15" - "@webassemblyjs/ast" "^1.14.1" - "@webassemblyjs/wasm-edit" "^1.14.1" - "@webassemblyjs/wasm-parser" "^1.14.1" - acorn "^8.15.0" - acorn-import-phases "^1.0.3" - browserslist "^4.24.0" - chrome-trace-event "^1.0.2" - enhanced-resolve "^5.17.2" - es-module-lexer "^1.2.1" - eslint-scope "5.1.1" - events "^3.2.0" - glob-to-regexp "^0.4.1" - graceful-fs "^4.2.11" - json-parse-even-better-errors "^2.3.1" - loader-runner "^4.2.0" - mime-types "^2.1.27" - neo-async "^2.6.2" - schema-utils "^4.3.2" - tapable "^2.1.1" - terser-webpack-plugin "^5.3.11" - watchpack "^2.4.1" - webpack-sources "^3.3.3" - whatwg-encoding@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz#d0f4ef769905d426e1688f3e34381a99b60b76e5"