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

Update dependencies & config for upload-file-via-browser demo. #891

Merged
merged 1 commit into from
Nov 20, 2018
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
16 changes: 8 additions & 8 deletions examples/upload-file-via-browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
],
"license": "MIT",
"devDependencies": {
"babel-core": "^5.4.7",
"babel-loader": "^5.1.2",
"babel-core": "~6.26.3",
"babel-loader": "~8.0.4",
"ipfs-api": "../../",
"pull-file-reader": "^1.0.2",
"react": "^15.4.2",
"react-dom": "^15.4.2",
"react-hot-loader": "^1.3.1",
"webpack": "^2.0.0",
"webpack-dev-server": "^1.8.2"
"pull-file-reader": "~1.0.2",
"react": "~16.6.3",
"react-dom": "~16.6.3",
"react-hot-loader": "~4.3.12",
"webpack": "~4.25.1",
"webpack-dev-server": "~3.1.10"
}
}
6 changes: 3 additions & 3 deletions examples/upload-file-via-browser/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class App extends React.Component {
event.stopPropagation()
event.preventDefault()
const file = event.target.files[0]
if (document.getElementById("keepFilename").checked) {
if (document.getElementById('keepFilename').checked) {
this.saveToIpfsWithFilename(file)
} else {
this.saveToIpfs(file)
Expand Down Expand Up @@ -63,7 +63,7 @@ class App extends React.Component {
.then((response) => {
console.log(response)
// CID of wrapping directory is returned last
ipfsId = response[response.length-1].hash
ipfsId = response[response.length - 1].hash
console.log(ipfsId)
this.setState({added_file_hash: ipfsId})
}).catch((err) => {
Expand All @@ -80,7 +80,7 @@ class App extends React.Component {
<div>
<form id='captureMedia' onSubmit={this.handleSubmit}>
<input type='file' onChange={this.captureFile} /><br/>
<label for='keepFilename'><input type='checkbox' id='keepFilename' name='keepFilename' /> keep filename</label>
<label htmlFor='keepFilename'><input type='checkbox' id='keepFilename' name='keepFilename' /> keep filename</label>
</form>
<div>
<a target='_blank'
Expand Down
25 changes: 18 additions & 7 deletions examples/upload-file-via-browser/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
'use strict'

let path = require('path')
let webpack = require('webpack')
const path = require('path')
const webpack = require('webpack')

module.exports = {
mode: 'development',
devtool: 'eval',
entry: [
'webpack-dev-server/client?http://localhost:3000',
Expand All @@ -19,11 +20,21 @@ module.exports = {
new webpack.HotModuleReplacementPlugin()
],
module: {
loaders: [{
test: /\.js$/,
loaders: ['react-hot-loader', 'babel-loader'],
include: path.join(__dirname, 'src')
}]
rules: [
{
test: /\.js$/,
include: path.join(__dirname, 'src'),
use: [
{
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env', '@babel/preset-react'],
plugins: ['react-hot-loader/babel']
}
}
]
}
]
},
node: {
fs: 'empty',
Expand Down