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

Commit

Permalink
fix: updates webpack example to use v5 (#3512)
Browse files Browse the repository at this point in the history
Takes the config from the service worker example and uses it to patch up the webpack example to use v5

fixes: #3511
  • Loading branch information
achingbrain committed Jan 29, 2021
1 parent 899d529 commit c7110db
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 25 deletions.
12 changes: 7 additions & 5 deletions examples/browser-webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@
"@babel/preset-env": "^7.3.1",
"@babel/preset-react": "^7.0.0",
"babel-loader": "^8.0.5",
"copy-webpack-plugin": "^5.0.4",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"copy-webpack-plugin": "^7.0.0",
"node-polyfill-webpack-plugin": "^1.0.2",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-hot-loader": "^4.12.21",
"rimraf": "^3.0.2",
"stream-browserify": "^3.0.0",
"test-ipfs-example": "^2.0.3",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11",
"webpack": "^5.18.0",
"webpack-cli": "^4.4.0",
"webpack-dev-server": "^3.11.0"
},
"dependencies": {
Expand Down
30 changes: 19 additions & 11 deletions examples/browser-webpack/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
var path = require('path')
var webpack = require('webpack')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin')

module.exports = {
devtool: 'eval',
Expand All @@ -18,12 +19,24 @@ module.exports = {
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new CopyWebpackPlugin([{
from: 'index.html'
}, {
from: 'img',
to: 'static/img'
}])
new CopyWebpackPlugin({
patterns: [{
from: 'index.html'
}, {
from: 'img',
to: 'static/img'
}]
}),
// fixes Module not found: Error: Can't resolve 'stream' in '.../node_modules/nofilter/lib'
new NodePolyfillPlugin(),
// Note: stream-browserify has assumption about `Buffer` global in its
// dependencies causing runtime errors. This is a workaround to provide
// global `Buffer` until https://github.com/isaacs/core-util-is/issues/29
// is fixed.
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
process: 'process/browser'
})
],
module: {
rules: [
Expand All @@ -38,10 +51,5 @@ module.exports = {
}
}
]
},
node: {
fs: 'empty',
net: 'empty',
tls: 'empty'
}
}
2 changes: 1 addition & 1 deletion examples/custom-libp2p/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"license": "MIT",
"dependencies": {
"ipfs": "^0.53.2",
"libp2p": "^0.29.3",
"libp2p": "^0.30.0",
"libp2p-bootstrap": "^0.12.1",
"libp2p-kad-dht": "^0.20.1",
"libp2p-mdns": "^0.15.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/interface-ipfs-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"it-last": "^1.0.4",
"it-map": "^1.0.4",
"it-pushable": "^1.4.0",
"libp2p-crypto": "^0.18.0",
"libp2p-crypto": "^0.19.0",
"libp2p-websockets": "^0.15.0",
"multiaddr": "^8.0.0",
"multibase": "^3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/ipfs-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"it-glob": "0.0.10",
"it-pipe": "^1.1.0",
"jsondiffpatch": "^0.4.1",
"libp2p-crypto": "^0.18.0",
"libp2p-crypto": "^0.19.0",
"mafmt": "^8.0.0",
"multiaddr": "^8.0.0",
"multiaddr-to-uri": "^6.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/ipfs-core/.aegir.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let preloadNode = MockPreloadNode.createNode()
let ipfsdServer

module.exports = {
bundlesize: { maxSize: '600kB' },
bundlesize: { maxSize: '545kB' },
karma: {
files: [{
pattern: 'node_modules/interface-ipfs-core/test/fixtures/**/*',
Expand Down
4 changes: 2 additions & 2 deletions packages/ipfs-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"hamt-sharding": "^1.0.0",
"hashlru": "^2.3.0",
"interface-datastore": "^2.0.0",
"ipfs-bitswap": "^4.0.0",
"ipfs-bitswap": "^4.0.2",
"ipfs-block-service": "^0.18.0",
"ipfs-core-types": "^0.2.1",
"ipfs-core-utils": "^0.6.1",
Expand All @@ -91,7 +91,7 @@
"it-pipe": "^1.1.0",
"libp2p": "^0.30.0",
"libp2p-bootstrap": "^0.12.1",
"libp2p-crypto": "^0.18.0",
"libp2p-crypto": "^0.19.0",
"libp2p-floodsub": "^0.24.1",
"libp2p-gossipsub": "^0.8.0",
"libp2p-kad-dht": "^0.20.1",
Expand Down
1 change: 0 additions & 1 deletion packages/ipfs-core/src/components/libp2p.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ module.exports = ({
* @param {KeychainConfig} input.keychainConfig
* @param {PeerId} input.peerId
* @param {Multiaddr[]} input.multiaddrs
* @returns {Options}
*/
function getLibp2pOptions ({ options, config, datastore, keys, keychainConfig, peerId, multiaddrs }) {
const getPubsubRouter = () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/ipfs-grpc-server/src/endpoints/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ module.exports = function grpcAdd (ipfs, options = {}) {
fileInputStream.end(err)
} finally {
// clean up any open streams
streams.filter(Boolean).forEach(stream => stream.end())
streams.forEach(stream => stream && stream.end())
}
}, 0)

Expand Down
2 changes: 1 addition & 1 deletion packages/ipfs/.aegir.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ let sigServerB
let ipfsdServer

module.exports = {
bundlesize: { maxSize: '600kB' },
bundlesize: { maxSize: '545kB' },
karma: {
files: [{
pattern: 'node_modules/interface-ipfs-core/test/fixtures/**/*',
Expand Down

0 comments on commit c7110db

Please sign in to comment.