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

Commit d43a889

Browse files
committed
chore: fix examples, webpack5 all the things
1 parent 7245628 commit d43a889

File tree

67 files changed

+204
-255
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+204
-255
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ coverage
1111
tests_output
1212
cache
1313
.cache
14+
.parcel-cache
1415

1516
# Dependency directory
1617
node_modules

examples/browser-create-react-app/package.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"ipfs-css": "^0.13.1",
99
"react": "^16.8.6",
1010
"react-dom": "^16.8.6",
11-
"react-scripts": "^3.2.0",
11+
"react-scripts": "^4.0.3",
1212
"tachyons": "^4.11.1"
1313
},
1414
"devDependencies": {
@@ -26,9 +26,6 @@
2626
"extends": "react-app"
2727
},
2828
"browserslist": [
29-
">0.2%",
30-
"not dead",
31-
"not ie <= 11",
32-
"not op_mini all"
29+
"last 2 versions and not dead and > 2%"
3330
]
3431
}

examples/browser-http-client-upload-file/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"private": true,
66
"scripts": {
77
"clean": "rimraf ./dist",
8-
"build": "parcel build index.html --public-url '.'",
8+
"build": "parcel build index.html --no-scope-hoist",
99
"start": "parcel index.html",
1010
"test": "test-ipfs-example"
1111
},
@@ -19,7 +19,7 @@
1919
},
2020
"devDependencies": {
2121
"ipfs": "^0.54.4",
22-
"parcel-bundler": "^1.12.4",
22+
"parcel": "next",
2323
"react": "^16.8.6",
2424
"react-dom": "^16.8.6",
2525
"rimraf": "^3.0.2",

examples/browser-ipns-publish/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"private": true,
66
"main": "index.js",
77
"scripts": {
8-
"build": "parcel build index.html --public-url ./",
8+
"build": "parcel build index.html --no-scope-hoist",
99
"start": "parcel index.html",
1010
"test": "test-ipfs-example"
1111
},
@@ -29,7 +29,7 @@
2929
"execa": "^5.0.0",
3030
"ipfsd-ctl": "ipfs/js-ipfsd-ctl#chore/switch-to-create-for-http-client",
3131
"go-ipfs": "0.8.0",
32-
"parcel-bundler": "^1.12.4",
32+
"parcel": "next",
3333
"path": "^0.12.7",
3434
"test-ipfs-example": "^3.0.0"
3535
},

examples/browser-mfs/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
"author": "",
1414
"license": "ISC",
1515
"devDependencies": {
16-
"html-webpack-plugin": "^3.2.0",
16+
"html-webpack-plugin": "^5.3.1",
1717
"http-server": "^0.12.3",
18+
"node-polyfill-webpack-plugin": "^1.0.3",
1819
"rimraf": "^3.0.2",
19-
"terser-webpack-plugin": "^1.2.1",
2020
"test-ipfs-example": "^3.0.0",
21-
"webpack": "^4.43.0",
22-
"webpack-cli": "^3.3.11"
21+
"webpack": "^5.28.0",
22+
"webpack-cli": "^4.5.0"
2323
},
2424
"dependencies": {
2525
"ipfs": "^0.54.4",
Lines changed: 18 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,33 @@
11
'use strict'
22

33
const path = require('path')
4-
const TerserPlugin = require('terser-webpack-plugin')
4+
const webpack = require('webpack')
5+
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin')
56
const HtmlWebpackPlugin = require('html-webpack-plugin')
67

78
module.exports = {
8-
mode: 'development',
9-
devtool: 'source-map',
9+
devtool: 'eval',
1010
entry: [
1111
'./index.js'
1212
],
13+
output: {
14+
path: path.join(__dirname, 'dist'),
15+
filename: 'bundle.js'
16+
},
1317
plugins: [
1418
new HtmlWebpackPlugin({
1519
title: 'IPFS MFS example',
1620
template: 'index.html'
21+
}),
22+
// fixes Module not found: Error: Can't resolve 'stream' in '.../node_modules/nofilter/lib'
23+
new NodePolyfillPlugin(),
24+
// Note: stream-browserify has assumption about `Buffer` global in its
25+
// dependencies causing runtime errors. This is a workaround to provide
26+
// global `Buffer` until https://github.com/isaacs/core-util-is/issues/29
27+
// is fixed.
28+
new webpack.ProvidePlugin({
29+
Buffer: ['buffer', 'Buffer'],
30+
process: 'process/browser'
1731
})
18-
],
19-
optimization: {
20-
minimizer: [
21-
new TerserPlugin({
22-
terserOptions: {
23-
parse: {
24-
// we want terser to parse ecma 8 code. However, we don't want it
25-
// to apply any minfication steps that turns valid ecma 5 code
26-
// into invalid ecma 5 code. This is why the 'compress' and 'output'
27-
// sections only apply transformations that are ecma 5 safe
28-
// https://github.com/facebook/create-react-app/pull/4234
29-
ecma: 8
30-
},
31-
compress: {
32-
ecma: 5,
33-
warnings: false
34-
},
35-
mangle: {
36-
safari10: true
37-
},
38-
output: {
39-
ecma: 5,
40-
comments: false
41-
}
42-
},
43-
// Use multi-process parallel running to improve the build speed
44-
// Default number of concurrent runs: os.cpus().length - 1
45-
parallel: true,
46-
// Enable file caching
47-
cache: true,
48-
sourceMap: true
49-
})
50-
]
51-
},
52-
output: {
53-
path: path.join(__dirname, 'dist'),
54-
filename: 'bundle.js'
55-
},
56-
node: {
57-
fs: 'empty'
58-
}
32+
]
5933
}

examples/browser-parceljs/.babelrc

Lines changed: 0 additions & 4 deletions
This file was deleted.

examples/browser-parceljs/package.json

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
"name": "example-browser-parceljs",
33
"description": "",
44
"version": "1.0.2",
5-
"main": "index.js",
5+
"main": "dist/index.html",
66
"private": true,
77
"browserslist": [
8-
"last 2 Chrome versions"
8+
"last 2 versions and not dead and > 2%"
99
],
1010
"scripts": {
1111
"clean": "rimraf ./dist",
1212
"lint": "standard public/**/*.js",
1313
"start": "parcel public/index.html",
14-
"build": "parcel build public/index.html --public-url ./",
14+
"build": "parcel build public/index.html --no-scope-hoist",
1515
"test": "test-ipfs-example"
1616
},
1717
"keywords": [],
@@ -21,15 +21,9 @@
2121
"ipfs": "^0.54.4"
2222
},
2323
"devDependencies": {
24-
"@babel/cli": "7.13.0",
25-
"@babel/core": "7.13.0",
26-
"@babel/preset-env": "7.13.0",
27-
"babel-plugin-syntax-async-functions": "^6.13.0",
28-
"babel-plugin-transform-regenerator": "^6.26.0",
29-
"babel-polyfill": "^6.26.0",
30-
"parcel-bundler": "^1.12.4",
24+
"parcel": "next",
3125
"rimraf": "^3.0.2",
32-
"standard": "^13.1.0",
26+
"standard": "^16.0.3",
3327
"test-ipfs-example": "^3.0.0"
3428
}
3529
}

examples/browser-parceljs/public/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import 'babel-polyfill'
21
import IPFS from 'ipfs'
32
import uint8ArrayConcat from 'uint8arrays/concat'
43
import uint8ArrayToString from 'uint8arrays/to-string'

examples/browser-readablestream/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@
1313
"author": "",
1414
"license": "ISC",
1515
"devDependencies": {
16-
"html-webpack-plugin": "^3.2.0",
16+
"html-webpack-plugin": "^5.3.1",
1717
"http-server": "^0.12.3",
18+
"node-polyfill-webpack-plugin": "^1.0.3",
1819
"rimraf": "^3.0.2",
19-
"terser-webpack-plugin": "^1.2.1",
2020
"test-ipfs-example": "^3.0.0",
21-
"webpack": "^4.43.0"
21+
"webpack": "^5.28.0",
22+
"webpack-cli": "^4.5.0"
2223
},
2324
"dependencies": {
2425
"ipfs": "^0.54.4",

0 commit comments

Comments
 (0)