Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Commit e79179c

Browse files
Zhiyuan LinAlan Shaw
Zhiyuan Lin
authored and
Alan Shaw
committed
docs: update dependencies & config for upload-file-via-browser demo. (#891)
1 parent 39f4733 commit e79179c

File tree

3 files changed

+29
-18
lines changed

3 files changed

+29
-18
lines changed

examples/upload-file-via-browser/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
],
1212
"license": "MIT",
1313
"devDependencies": {
14-
"babel-core": "^5.4.7",
15-
"babel-loader": "^5.1.2",
14+
"babel-core": "~6.26.3",
15+
"babel-loader": "~8.0.4",
1616
"ipfs-api": "../../",
17-
"pull-file-reader": "^1.0.2",
18-
"react": "^15.4.2",
19-
"react-dom": "^15.4.2",
20-
"react-hot-loader": "^1.3.1",
21-
"webpack": "^2.0.0",
22-
"webpack-dev-server": "^1.8.2"
17+
"pull-file-reader": "~1.0.2",
18+
"react": "~16.6.3",
19+
"react-dom": "~16.6.3",
20+
"react-hot-loader": "~4.3.12",
21+
"webpack": "~4.25.1",
22+
"webpack-dev-server": "~3.1.10"
2323
}
2424
}

examples/upload-file-via-browser/src/App.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class App extends React.Component {
2323
event.stopPropagation()
2424
event.preventDefault()
2525
const file = event.target.files[0]
26-
if (document.getElementById("keepFilename").checked) {
26+
if (document.getElementById('keepFilename').checked) {
2727
this.saveToIpfsWithFilename(file)
2828
} else {
2929
this.saveToIpfs(file)
@@ -63,7 +63,7 @@ class App extends React.Component {
6363
.then((response) => {
6464
console.log(response)
6565
// CID of wrapping directory is returned last
66-
ipfsId = response[response.length-1].hash
66+
ipfsId = response[response.length - 1].hash
6767
console.log(ipfsId)
6868
this.setState({added_file_hash: ipfsId})
6969
}).catch((err) => {
@@ -80,7 +80,7 @@ class App extends React.Component {
8080
<div>
8181
<form id='captureMedia' onSubmit={this.handleSubmit}>
8282
<input type='file' onChange={this.captureFile} /><br/>
83-
<label for='keepFilename'><input type='checkbox' id='keepFilename' name='keepFilename' /> keep filename</label>
83+
<label htmlFor='keepFilename'><input type='checkbox' id='keepFilename' name='keepFilename' /> keep filename</label>
8484
</form>
8585
<div>
8686
<a target='_blank'

examples/upload-file-via-browser/webpack.config.js

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
'use strict'
22

3-
let path = require('path')
4-
let webpack = require('webpack')
3+
const path = require('path')
4+
const webpack = require('webpack')
55

66
module.exports = {
7+
mode: 'development',
78
devtool: 'eval',
89
entry: [
910
'webpack-dev-server/client?http://localhost:3000',
@@ -19,11 +20,21 @@ module.exports = {
1920
new webpack.HotModuleReplacementPlugin()
2021
],
2122
module: {
22-
loaders: [{
23-
test: /\.js$/,
24-
loaders: ['react-hot-loader', 'babel-loader'],
25-
include: path.join(__dirname, 'src')
26-
}]
23+
rules: [
24+
{
25+
test: /\.js$/,
26+
include: path.join(__dirname, 'src'),
27+
use: [
28+
{
29+
loader: 'babel-loader',
30+
options: {
31+
presets: ['@babel/preset-env', '@babel/preset-react'],
32+
plugins: ['react-hot-loader/babel']
33+
}
34+
}
35+
]
36+
}
37+
]
2738
},
2839
node: {
2940
fs: 'empty',

0 commit comments

Comments
 (0)