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

fix: shared node demo #3203

Merged
merged 1 commit into from
Aug 3, 2020
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
2 changes: 1 addition & 1 deletion examples/browser-sharing-node-across-tabs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"worker-plugin": "4.0.3"
},
"dependencies": {
"ipfs": "^0.47.0",
"ipfs": "^0.48.0",
"ipfs-message-port-client": "^0.0.1",
"ipfs-message-port-server": "^0.0.1"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/browser-sharing-node-across-tabs/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const main = async () => {

const uploader = async (ipfs) => {
document.body.outerHTML += '<div>Adding "hello world!" to shared IPFS node</div>'
const entry = await ipfs.add(ipfs, new Blob(['hello world!'], { type: "text/plain" }))
const entry = await ipfs.add(new Blob(['hello world!'], { type: "text/plain" }))
const path = `/ipfs/${entry.cid}/`
document.body.outerHTML += `<div class="ipfs-add">File was added:
<a target="_blank" href="${new URL(`#${path}`, location)}">${path}</a>
Expand Down
9 changes: 7 additions & 2 deletions examples/browser-sharing-node-across-tabs/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 WorkerPlugin = require('worker-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')

module.exports = {
devtool: 'source-map',
Expand All @@ -13,14 +14,18 @@ module.exports = {
],
output: {
path: path.join(__dirname, 'dist'),
filename: 'static/bundle.js'
filename: 'static/bundle.js',
publicPath: '/'
},
plugins: [
new WorkerPlugin({
sharedWorker: true,
globalObject: 'self'
}),
new webpack.HotModuleReplacementPlugin()
new webpack.HotModuleReplacementPlugin(),
new CopyWebpackPlugin([{
from: 'index.html'
}])
],
module: {
rules: [
Expand Down