Skip to content

Commit 6b94e21

Browse files
authored
Merge pull request mac-s-g#76 from mac-s-g/remove-react-from-bundle
Remove react from bundle
2 parents 9b690cc + 5e8497f commit 6b94e21

File tree

10 files changed

+60
-16
lines changed

10 files changed

+60
-16
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node
1+
FROM node:8.1.2-slim
22
MAINTAINER mac <[email protected]>
33

44
# install the node modules at container build time

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,3 +149,4 @@ I'm also inspired by users who come up with interesting feature requests. Reach
149149
### To-Do's
150150
1. Improve documentation for `onAdd` and `onDelete` props
151151
2. Improve style organization
152+
3. Continue size analysis and remove larger dependencies from build where possible.

entrypoints/coverage.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ echo Running Coverage Report
33

44
cd /react
55

6+
echo Installing Test Dependencies
7+
sh ./entrypoints/install-test-dependencies.sh
8+
69
echo Running: npm run unit_test
710
npm run test:unit
811

entrypoints/debug.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
cd /react
44

5+
echo Installing Test Dependencies
6+
sh ./entrypoints/install-test-dependencies.sh
7+
58
echo getting source tree..
69
npm run modules:tree > debug/tree.json
710

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
npm install --silent \
2+
3+
4+
5+
6+
7+
8+
9+
10+
11+
12+
13+
14+

entrypoints/test.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@ echo Running Tests
33

44
cd /react
55

6+
echo Installing Test Dependencies
7+
sh ./entrypoints/install-test-dependencies.sh
8+
69
exec npm run test:unit

entrypoints/test_watch.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@
22
echo Running Tests
33
cd /react
44

5+
echo Installing Test Dependencies
6+
sh ./entrypoints/install-test-dependencies.sh
7+
58
exec npm run test:watch

package.json

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
{
22
"name": "react-json-view",
33
"description": "Interactive react component for displaying javascript arrays and JSON objects.",
4-
"version": "1.10.3",
4+
"version": "1.10.4",
55
"main": "dist/main.js",
66
"files": [
77
"dist/"
88
],
9+
"dependencies": {
10+
"clipboard": "^1.6.1",
11+
"flux": "^3.1.2",
12+
"radium":"^0.19.1",
13+
"react-base16-styling": "^0.5.3",
14+
"react-icons": "2.2.5",
15+
"react-tooltip": "^3.3.0"
16+
},
917
"devDependencies": {
1018
"babel-core": "^6.21.0",
1119
"babel-loader": "^6.2.10",
@@ -19,31 +27,26 @@
1927
"babel-preset-stage-0": "^6.24.1",
2028
"babel-preset-stage-2": "^6.24.1",
2129
"babel-register": "^6.24.1",
30+
"html-webpack-plugin": "2.28.0",
31+
"react-hot-loader": "^3.0.0-beta.6",
32+
"webpack": "^2.2.1",
33+
"webpack-dev-server": "^2.3.0"
34+
},
35+
"peerDependencies": {
2236
"chai": "^3.5.0",
23-
"clipboard": "^1.6.1",
2437
"coveralls": "^2.13.1",
2538
"enzyme": "^2.8.2",
26-
"flux": "^3.1.2",
27-
"html-webpack-plugin": "2.28.0",
2839
"ignore-styles": "^5.0.1",
2940
"istanbul": "^0.4.5",
3041
"jsdom": "^10.1.0",
3142
"mocha": "^3.2.0",
3243
"nyc": "^10.3.2",
33-
"radium":"^0.19.1",
3444
"react": "^15.5.4",
35-
"react-base16-styling": "^0.5.3",
3645
"react-dom": "^15.5.4",
37-
"react-hot-loader": "^3.0.0-beta.6",
38-
"react-icons": "2.2.5",
3946
"react-test-renderer": "^15.5.4",
40-
"react-tooltip": "^3.3.0",
4147
"sinon": "^2.2.0",
42-
"webpack": "^2.2.1",
43-
"webpack-bundle-size-analyzer": "^2.7.0",
44-
"webpack-dev-server": "^2.3.0"
48+
"webpack-bundle-size-analyzer": "^2.7.0"
4549
},
46-
"dependencies": {},
4750
"scripts": {
4851
"build": "webpack -p --display-error-details --progress",
4952
"dev:hot": "webpack-dev-server",

src/html/index.html.template

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
<script src="//cdnjs.cloudflare.com/ajax/libs/es5-shim/3.4.0/es5-shim.js"></script>
1616
<script src="//cdnjs.cloudflare.com/ajax/libs/es5-shim/3.4.0/es5-sham.js"></script>
1717
<![endif]-->
18+
<script src="https://unpkg.com/react@15/dist/react.js"></script>
19+
<script src="https://unpkg.com/react-dom@15/dist/react-dom.js"></script>
1820
<style>
1921
.react-json-view {
2022
padding: 4px 6px;

webpack.config.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,20 @@ const config = {
2323
entry: [entrypoint],
2424
externals: {
2525
'cheerio': 'window',
26-
'react/lib/ExecutionEnvironment': true,
27-
'react/lib/ReactContext': true,
26+
react: {
27+
root: 'React',
28+
commonjs2: 'react',
29+
commonjs: 'react',
30+
amd: 'react',
31+
umd: 'react',
32+
},
33+
'react-dom': {
34+
root: 'ReactDOM',
35+
commonjs2: 'react-dom',
36+
commonjs: 'react-dom',
37+
amd: 'react-dom',
38+
umd: 'react-dom',
39+
},
2840
},
2941
devServer: {
3042
host: '0.0.0.0',

0 commit comments

Comments
 (0)