Skip to content

Commit c065035

Browse files
authored
Update readme.md for using with Webpack 5
1 parent b65ad09 commit c065035

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,39 @@ The only differences with a traditional create-react-app application are :
1111
See [`src/App.js`](./src/App.js) for the code.
1212

1313
### [view the live demo](https://react-sqljs-demo.ophir.dev/)
14+
15+
## Using with Webpack 5
16+
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
17+
```js
18+
module.exports = {
19+
webpack: {
20+
configure: {
21+
module: {
22+
rules: [
23+
{
24+
test: /\.wasm$/,
25+
type: 'javascript/auto',
26+
use: [
27+
{ loader: 'file-loader' }
28+
]
29+
},
30+
},
31+
resolve: {
32+
fallback: {
33+
'path': require.resolve('path-browserify'),
34+
'crypto': require.resolve('crypto-browserify'),
35+
'stream': require.resolve('stream-browserify')
36+
}
37+
},
38+
},
39+
},
40+
};
41+
```
42+
And add the required module to your project
43+
```
44+
npm install -D path-browserify crypto-browserify stream-browserify
45+
```
46+
or
47+
```
48+
yarn add -D path-browserify crypto-browserify stream-browserify
49+
```

0 commit comments

Comments
 (0)