Skip to content

Commit 65915cd

Browse files
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.
1 parent b65ad09 commit 65915cd

File tree

2 files changed

+25
-12
lines changed

2 files changed

+25
-12
lines changed

Diff for: craco.config.js

+19-11
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
module.exports = {
22
webpack: {
3-
configure:{
4-
// See https://github.com/webpack/webpack/issues/6725
5-
module:{
6-
rules: [{
7-
test: /\.wasm$/,
8-
type: 'javascript/auto',
9-
}]
10-
}
11-
}
12-
}
13-
};
3+
configure: (webpackConfig) => {
4+
// Add the following lines to handle 'crypto' and 'fs' dependencies
5+
webpackConfig.resolve.fallback = {
6+
fs: require.resolve("browserify-fs"), // or 'empty' if you prefer an empty module
7+
crypto: require.resolve('crypto-browserify'),
8+
stream: require.resolve('stream-browserify'),
9+
};
10+
11+
// Add the 'module' configuration for handling .wasm files
12+
webpackConfig.module.rules.push({
13+
test: /\.wasm$/,
14+
type: 'javascript/auto',
15+
});
16+
17+
return webpackConfig;
18+
},
19+
},
20+
};
21+

Diff for: package.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,17 @@
99
"main": "src/index.js",
1010
"license": "MIT",
1111
"dependencies": {
12+
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
13+
"browserify-fs": "^1.0.0",
14+
"crypto-browserify": "^3.12.0",
1215
"react": "^17.0.2",
1316
"react-dom": "^17.0.2",
14-
"sql.js": "^1.6.2"
17+
"sql.js": "^1.6.2",
18+
"stream-browserify": "^3.0.0"
1519
},
1620
"devDependencies": {
1721
"@craco/craco": "^5.9.0",
22+
"react-scripts": "^5.0.1",
1823
"typescript": "^4.5.5"
1924
},
2025
"scripts": {

0 commit comments

Comments
 (0)