From 65915cd2010a313efd88e49829222ff37ea5b38b Mon Sep 17 00:00:00 2001 From: calculatingzero <20590197+CalculatingZero@users.noreply.github.com> Date: Fri, 1 Dec 2023 03:24:38 -0800 Subject: [PATCH] update package.json and craco.config.js (#26) - added the following dependencies: "@babel/plugin-proposal-private-property-in-object": "^7.21.11", "browserify-fs": "^1.0.0", "crypto-browserify": "^3.12.0", "react-scripts": "^5.0.1", - add fallbacks to the webpackConfig. - project will now build and start. --- craco.config.js | 30 +++++++++++++++++++----------- package.json | 7 ++++++- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/craco.config.js b/craco.config.js index 7a6e104..51efce8 100644 --- a/craco.config.js +++ b/craco.config.js @@ -1,13 +1,21 @@ module.exports = { webpack: { - configure:{ - // See https://github.com/webpack/webpack/issues/6725 - module:{ - rules: [{ - test: /\.wasm$/, - type: 'javascript/auto', - }] - } - } - } -}; \ No newline at end of file + configure: (webpackConfig) => { + // Add the following lines to handle 'crypto' and 'fs' dependencies + webpackConfig.resolve.fallback = { + fs: require.resolve("browserify-fs"), // or 'empty' if you prefer an empty module + crypto: require.resolve('crypto-browserify'), + stream: require.resolve('stream-browserify'), + }; + + // Add the 'module' configuration for handling .wasm files + webpackConfig.module.rules.push({ + test: /\.wasm$/, + type: 'javascript/auto', + }); + + return webpackConfig; + }, + }, + }; + \ No newline at end of file diff --git a/package.json b/package.json index 8020f89..5a53d82 100644 --- a/package.json +++ b/package.json @@ -9,12 +9,17 @@ "main": "src/index.js", "license": "MIT", "dependencies": { + "@babel/plugin-proposal-private-property-in-object": "^7.21.11", + "browserify-fs": "^1.0.0", + "crypto-browserify": "^3.12.0", "react": "^17.0.2", "react-dom": "^17.0.2", - "sql.js": "^1.6.2" + "sql.js": "^1.6.2", + "stream-browserify": "^3.0.0" }, "devDependencies": { "@craco/craco": "^5.9.0", + "react-scripts": "^5.0.1", "typescript": "^4.5.5" }, "scripts": {