From 9c72dd05c45320e73aeebbea0e8cc91d71eec8f6 Mon Sep 17 00:00:00 2001 From: svrnm Date: Wed, 3 May 2023 17:50:32 +0200 Subject: [PATCH] chore: bump webpack dependencies to 5.x Signed-off-by: svrnm --- karma.base.js | 5 ++--- karma.webpack.js | 22 ++++++++++++++----- package.json | 1 + .../package.json | 19 ++++++++-------- 4 files changed, 29 insertions(+), 18 deletions(-) diff --git a/karma.base.js b/karma.base.js index 70435dda11..38bb6d6806 100644 --- a/karma.base.js +++ b/karma.base.js @@ -18,7 +18,7 @@ module.exports = { listenAddress: 'localhost', hostname: 'localhost', browsers: ['ChromeHeadless'], - frameworks: ['mocha'], + frameworks: ['mocha', 'webpack'], coverageIstanbulReporter: { reports: ['json'], dir: '.nyc_output', @@ -26,6 +26,5 @@ module.exports = { }, reporters: ['spec', 'coverage-istanbul'], files: ['test/index-webpack.ts'], - preprocessors: { 'test/index-webpack.ts': ['webpack'] }, - webpackMiddleware: { noInfo: true } + preprocessors: { 'test/index-webpack.ts': ['webpack'] } }; diff --git a/karma.webpack.js b/karma.webpack.js index 546704817a..36d47dbb1a 100644 --- a/karma.webpack.js +++ b/karma.webpack.js @@ -14,13 +14,19 @@ * limitations under the License. */ -const webpackNodePolyfills = require('./webpack.node-polyfills.js'); +const path = require('path'); +const os = require('os'); +const NodePolyfillPlugin = require('node-polyfill-webpack-plugin'); + // This is the webpack configuration for browser Karma tests with coverage. module.exports = { mode: 'development', target: 'web', - output: { filename: 'bundle.js' }, + output: { + filename: '[name].js', + path: path.join(os.tmpdir(), '_karma_22_webpack_') + Math.floor(Math.random() * 1000000) , + }, resolve: { extensions: ['.ts', '.js', '.tsx'] }, devtool: 'inline-source-map', module: { @@ -37,10 +43,14 @@ module.exports = { esModules: true } } - }, - // This setting configures Node polyfills for the browser that will be - // added to the webpack bundle for Karma tests. - { parser: { node: webpackNodePolyfills } } + } ] + }, + plugins: [ + new NodePolyfillPlugin() + ], + optimization: { + runtimeChunk: false, + splitChunks: false } }; diff --git a/package.json b/package.json index 24049e1ff7..867494e4b6 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,7 @@ "husky": "7.0.4", "lerna": "5.5.2", "lerna-changelog": "2.2.0", + "node-polyfill-webpack-plugin": "^2.0.1", "prettier": "2.8.7", "typescript": "4.4.4" }, diff --git a/plugins/web/opentelemetry-instrumentation-user-interaction/package.json b/plugins/web/opentelemetry-instrumentation-user-interaction/package.json index a7ce2daf67..08846dca1e 100644 --- a/plugins/web/opentelemetry-instrumentation-user-interaction/package.json +++ b/plugins/web/opentelemetry-instrumentation-user-interaction/package.json @@ -48,6 +48,7 @@ }, "devDependencies": { "@babel/core": "7.15.0", + "@jsdevtools/coverage-istanbul-loader": "3.0.5", "@opentelemetry/api": "^1.3.0", "@opentelemetry/context-zone-peer-dep": "^1.8.0", "@opentelemetry/instrumentation-xml-http-request": "^0.38.0", @@ -57,31 +58,31 @@ "@types/node": "18.11.7", "@types/sinon": "10.0.2", "@types/webpack-env": "1.16.2", - "babel-loader": "8.2.2", - "@jsdevtools/coverage-istanbul-loader": "3.0.5", - "karma": "6.3.16", + "babel-loader": "9.1.2", + "karma": "6.4.2", "karma-chrome-launcher": "^3.1.1", "karma-coverage-istanbul-reporter": "3.0.3", "karma-jquery": "0.2.4", "karma-mocha": "2.0.1", - "karma-spec-reporter": "0.0.32", - "karma-webpack": "4.0.2", + "karma-spec-reporter": "0.0.36", + "karma-webpack": "5.0.0", "mocha": "7.2.0", "nyc": "15.1.0", "rimraf": "4.2.0", "sinon": "15.0.1", - "ts-loader": "8.3.0", + "ts-loader": "9.4.2", "ts-mocha": "10.0.0", "typescript": "4.4.4", - "webpack": "4.46.0", - "webpack-cli": "4.7.2", + "webpack": "5.81.0", + "webpack-cli": "5.0.2", "webpack-merge": "5.8.0", "zone.js": "0.11.4" }, "dependencies": { "@opentelemetry/core": "^1.8.0", "@opentelemetry/instrumentation": "^0.38.0", - "@opentelemetry/sdk-trace-web": "^1.8.0" + "@opentelemetry/sdk-trace-web": "^1.8.0", + "node-polyfill-webpack-plugin": "^2.0.1" }, "peerDependencies": { "@opentelemetry/api": "^1.3.0",