Skip to content

update package.json and craco.config.js #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 19 additions & 11 deletions craco.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
module.exports = {
webpack: {
configure:{
// See https://github.com/webpack/webpack/issues/6725
module:{
rules: [{
test: /\.wasm$/,
type: 'javascript/auto',
}]
}
}
}
};
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;
},
},
};

7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down