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

Commit

Permalink
docs(example): fix webpack example
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Jan 25, 2017
1 parent f88ae95 commit b7ce4a7
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 10 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ Simply require it as you would do for Node.js, but when transpiling+minifying wi

You can also find examples of how to do this bundling at: `https://github.com/ipfs/js-ipfs/tree/master/examples`

Special note, if you are using webpack, make sure to use version 2 or above, otherwise it won't work.

### Use in a browser using a script tag

Loading this module in a browser (using a `<script>` tag) makes the `Ipfs` object available in the global namespace.
Expand Down
5 changes: 4 additions & 1 deletion examples/bundle-webpack/.babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"stage": 0
"presets": [
"stage-0",
"react"
]
}
4 changes: 4 additions & 0 deletions examples/bundle-webpack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ You should see the following:
## Special note

In order to use js-ipfs in the browser, you need to replace the default `zlib` library by `browserify-zlib-next`, a full implementation of the native `zlib` package, full in Node.js. See the WebPack config to learn how to do this and avoid this pitfall. More context on: https://github.com/ipfs/js-ipfs#use-in-the-browser-with-browserify-webpack-or-any-bundler

## Special note 2

You need to use WebPack@2 or above, version 1 won't work
17 changes: 9 additions & 8 deletions examples/bundle-webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
"version": "1.0.0",
"description": "Bundle js-ipfs with WebPack",
"scripts": {
"start": "node src/server.js"
"start": "node server.js"
},
"license": "MIT",
"keywords": [],
"devDependencies": {
"babel-core": "^5.4.7",
"babel-loader": "^5.1.2",
"json-loader": "^0.5.3",
"react": "^0.13.0",
"react-hot-loader": "^1.3.0",
"webpack": "^1.9.6",
"webpack-dev-server": "^1.8.2"
"babel-core": "^6.22.1",
"babel-loader": "^6.2.10",
"babel-preset-react": "^6.22.0",
"json-loader": "^0.5.4",
"react": "^15.4.2",
"react-hot-loader": "^1.3.1",
"webpack": "^2.2.0",
"webpack-dev-server": "^1.16.2"
},
"dependencies": {
"browserify-zlib-next": "^1.0.1"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = {
module: {
loaders: [{
test: /\.js$/,
loaders: ['react-hot', 'babel'],
loaders: ['react-hot-loader', 'babel-loader'],
include: path.join(__dirname, 'src')
}, { test: /\.json$/, loader: 'json-loader' }]
},
Expand Down

0 comments on commit b7ce4a7

Please sign in to comment.