From 87ee209c9c8f24e500e6b499008dc26c93bc7dfa Mon Sep 17 00:00:00 2001 From: sanketshevkar Date: Thu, 12 Dec 2024 18:52:59 +0530 Subject: [PATCH] fix(utils): fix browser build for concerto-util Signed-off-by: sanketshevkar --- package-lock.json | 3 ++- packages/concerto-cto/package.json | 1 + packages/concerto-cto/webpack.config.js | 17 +++++++++++++++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index e52299376b..6e1207efb0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14009,6 +14009,7 @@ "eslint": "8.57.1", "jsdoc": "^4.0.4", "mocha": "10.8.2", + "node-polyfill-webpack-plugin": "4.0.0", "nyc": "17.1.0", "peggy": "4.2.0", "sinon": "19.0.2", @@ -14048,7 +14049,7 @@ "eslint": "8.57.1", "jest": "29.7.0", "npm-run-all": "4.1.5", - "rimraf": "^6.0.1", + "rimraf": "6.0.1", "ts-jest": "29.2.5" }, "engines": { diff --git a/packages/concerto-cto/package.json b/packages/concerto-cto/package.json index c62e88af46..05b437c86d 100644 --- a/packages/concerto-cto/package.json +++ b/packages/concerto-cto/package.json @@ -45,6 +45,7 @@ "eslint": "8.57.1", "jsdoc": "^4.0.4", "mocha": "10.8.2", + "node-polyfill-webpack-plugin": "4.0.0", "nyc": "17.1.0", "peggy": "4.2.0", "sinon": "19.0.2", diff --git a/packages/concerto-cto/webpack.config.js b/packages/concerto-cto/webpack.config.js index cdc2603e64..ea8b7ee516 100644 --- a/packages/concerto-cto/webpack.config.js +++ b/packages/concerto-cto/webpack.config.js @@ -16,6 +16,7 @@ let path = require('path'); const webpack = require('webpack'); +const NodePolyfillPlugin = require('node-polyfill-webpack-plugin'); const packageJson = require('./package.json'); @@ -45,6 +46,7 @@ module.exports = { 'NODE_ENV': JSON.stringify('production') } }), + new NodePolyfillPlugin(), ], module: { rules: [ @@ -64,7 +66,18 @@ module.exports = { // Webpack 5 no longer polyfills Node.js core modules automatically. // see https://webpack.js.org/configuration/resolve/#resolvefallback // for the list of Node.js core module polyfills. - 'path': 'path-browserify' + 'fs': false, + 'tls': false, + 'net': false, + 'child_process': false, + 'os': false, + 'path': false, + // 'crypto': require.resolve('crypto-browserify'), + // 'stream': require.resolve('stream-browserify'), + // 'http': require.resolve('stream-http'), + // 'https': require.resolve('https-browserify'), + // 'zlib': require.resolve('browserify-zlib'), + // 'vm2': require.resolve('vm-browserify'), } } -}; \ No newline at end of file +};