Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit c7110db

Browse files
authored
fix: updates webpack example to use v5 (#3512)
Takes the config from the service worker example and uses it to patch up the webpack example to use v5 fixes: #3511
1 parent 899d529 commit c7110db

File tree

10 files changed

+34
-25
lines changed

10 files changed

+34
-25
lines changed

examples/browser-webpack/package.json

+7-5
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,16 @@
1616
"@babel/preset-env": "^7.3.1",
1717
"@babel/preset-react": "^7.0.0",
1818
"babel-loader": "^8.0.5",
19-
"copy-webpack-plugin": "^5.0.4",
20-
"react": "^16.8.6",
21-
"react-dom": "^16.8.6",
19+
"copy-webpack-plugin": "^7.0.0",
20+
"node-polyfill-webpack-plugin": "^1.0.2",
21+
"react": "^17.0.1",
22+
"react-dom": "^17.0.1",
2223
"react-hot-loader": "^4.12.21",
2324
"rimraf": "^3.0.2",
25+
"stream-browserify": "^3.0.0",
2426
"test-ipfs-example": "^2.0.3",
25-
"webpack": "^4.43.0",
26-
"webpack-cli": "^3.3.11",
27+
"webpack": "^5.18.0",
28+
"webpack-cli": "^4.4.0",
2729
"webpack-dev-server": "^3.11.0"
2830
},
2931
"dependencies": {

examples/browser-webpack/webpack.config.js

+19-11
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
var path = require('path')
44
var webpack = require('webpack')
55
const CopyWebpackPlugin = require('copy-webpack-plugin')
6+
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin')
67

78
module.exports = {
89
devtool: 'eval',
@@ -18,12 +19,24 @@ module.exports = {
1819
},
1920
plugins: [
2021
new webpack.HotModuleReplacementPlugin(),
21-
new CopyWebpackPlugin([{
22-
from: 'index.html'
23-
}, {
24-
from: 'img',
25-
to: 'static/img'
26-
}])
22+
new CopyWebpackPlugin({
23+
patterns: [{
24+
from: 'index.html'
25+
}, {
26+
from: 'img',
27+
to: 'static/img'
28+
}]
29+
}),
30+
// fixes Module not found: Error: Can't resolve 'stream' in '.../node_modules/nofilter/lib'
31+
new NodePolyfillPlugin(),
32+
// Note: stream-browserify has assumption about `Buffer` global in its
33+
// dependencies causing runtime errors. This is a workaround to provide
34+
// global `Buffer` until https://github.com/isaacs/core-util-is/issues/29
35+
// is fixed.
36+
new webpack.ProvidePlugin({
37+
Buffer: ['buffer', 'Buffer'],
38+
process: 'process/browser'
39+
})
2740
],
2841
module: {
2942
rules: [
@@ -38,10 +51,5 @@ module.exports = {
3851
}
3952
}
4053
]
41-
},
42-
node: {
43-
fs: 'empty',
44-
net: 'empty',
45-
tls: 'empty'
4654
}
4755
}

examples/custom-libp2p/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"license": "MIT",
1212
"dependencies": {
1313
"ipfs": "^0.53.2",
14-
"libp2p": "^0.29.3",
14+
"libp2p": "^0.30.0",
1515
"libp2p-bootstrap": "^0.12.1",
1616
"libp2p-kad-dht": "^0.20.1",
1717
"libp2p-mdns": "^0.15.0",

packages/interface-ipfs-core/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"it-last": "^1.0.4",
5555
"it-map": "^1.0.4",
5656
"it-pushable": "^1.4.0",
57-
"libp2p-crypto": "^0.18.0",
57+
"libp2p-crypto": "^0.19.0",
5858
"libp2p-websockets": "^0.15.0",
5959
"multiaddr": "^8.0.0",
6060
"multibase": "^3.0.0",

packages/ipfs-cli/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"it-glob": "0.0.10",
5252
"it-pipe": "^1.1.0",
5353
"jsondiffpatch": "^0.4.1",
54-
"libp2p-crypto": "^0.18.0",
54+
"libp2p-crypto": "^0.19.0",
5555
"mafmt": "^8.0.0",
5656
"multiaddr": "^8.0.0",
5757
"multiaddr-to-uri": "^6.0.0",

packages/ipfs-core/.aegir.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ let preloadNode = MockPreloadNode.createNode()
88
let ipfsdServer
99

1010
module.exports = {
11-
bundlesize: { maxSize: '600kB' },
11+
bundlesize: { maxSize: '545kB' },
1212
karma: {
1313
files: [{
1414
pattern: 'node_modules/interface-ipfs-core/test/fixtures/**/*',

packages/ipfs-core/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
"hamt-sharding": "^1.0.0",
6969
"hashlru": "^2.3.0",
7070
"interface-datastore": "^2.0.0",
71-
"ipfs-bitswap": "^4.0.0",
71+
"ipfs-bitswap": "^4.0.2",
7272
"ipfs-block-service": "^0.18.0",
7373
"ipfs-core-types": "^0.2.1",
7474
"ipfs-core-utils": "^0.6.1",
@@ -91,7 +91,7 @@
9191
"it-pipe": "^1.1.0",
9292
"libp2p": "^0.30.0",
9393
"libp2p-bootstrap": "^0.12.1",
94-
"libp2p-crypto": "^0.18.0",
94+
"libp2p-crypto": "^0.19.0",
9595
"libp2p-floodsub": "^0.24.1",
9696
"libp2p-gossipsub": "^0.8.0",
9797
"libp2p-kad-dht": "^0.20.1",

packages/ipfs-core/src/components/libp2p.js

-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ module.exports = ({
5454
* @param {KeychainConfig} input.keychainConfig
5555
* @param {PeerId} input.peerId
5656
* @param {Multiaddr[]} input.multiaddrs
57-
* @returns {Options}
5857
*/
5958
function getLibp2pOptions ({ options, config, datastore, keys, keychainConfig, peerId, multiaddrs }) {
6059
const getPubsubRouter = () => {

packages/ipfs-grpc-server/src/endpoints/add.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ module.exports = function grpcAdd (ipfs, options = {}) {
8383
fileInputStream.end(err)
8484
} finally {
8585
// clean up any open streams
86-
streams.filter(Boolean).forEach(stream => stream.end())
86+
streams.forEach(stream => stream && stream.end())
8787
}
8888
}, 0)
8989

packages/ipfs/.aegir.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ let sigServerB
1515
let ipfsdServer
1616

1717
module.exports = {
18-
bundlesize: { maxSize: '600kB' },
18+
bundlesize: { maxSize: '545kB' },
1919
karma: {
2020
files: [{
2121
pattern: 'node_modules/interface-ipfs-core/test/fixtures/**/*',

0 commit comments

Comments
 (0)