Skip to content

Update readme.md for use with Webpack 5 #24

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Next Next commit
Update readme.md for using with Webpack 5
  • Loading branch information
dbuchet authored Jan 10, 2023
commit c065035289f513323fc8b7fe9fca25cf9fc55753
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,39 @@ The only differences with a traditional create-react-app application are :
See [`src/App.js`](./src/App.js) for the code.

### [view the live demo](https://react-sqljs-demo.ophir.dev/)

## Using with Webpack 5
Webpack 5 do not include nodejs polyfills by default, and you'll have to explicitely specify the file-loader for `wasm` file. So you'll need to update `craco.config.js` as below
```js
module.exports = {
webpack: {
configure: {
module: {
rules: [
{
test: /\.wasm$/,
type: 'javascript/auto',
use: [
{ loader: 'file-loader' }
]
},
},
resolve: {
fallback: {
'path': require.resolve('path-browserify'),
'crypto': require.resolve('crypto-browserify'),
'stream': require.resolve('stream-browserify')
}
},
},
},
};
```
And add the required module to your project
```
npm install -D path-browserify crypto-browserify stream-browserify
```
or
```
yarn add -D path-browserify crypto-browserify stream-browserify
```