Skip to content

Commit 959cfc1

Browse files
committed
upgrade examples
1 parent 5329be2 commit 959cfc1

File tree

4 files changed

+32
-21
lines changed

4 files changed

+32
-21
lines changed

Diff for: examples/.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules
2-
npm-debug.log
2+
npm-debug.log*
33
.DS_Store
4+
dist

Diff for: examples/package.json

+8-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"description": "Boilerplate for ReactJS project with hot code reloading",
55
"scripts": {
66
"start": "node server.js",
7-
"lint": "eslint src"
7+
"lint": "eslint src",
8+
"stats": "NODE_ENV=production webpack --json > dist/stats.json"
89
},
910
"repository": {
1011
"type": "git",
@@ -29,21 +30,21 @@
2930
"homepage": "https://github.com/gaearon/react-hot-boilerplate",
3031
"devDependencies": {
3132
"babel-core": "^6.7.7",
32-
"babel-eslint": "^6.0.3",
33+
"babel-eslint": "^7.1.1",
3334
"babel-loader": "^6.2.4",
3435
"babel-preset-es2015": "^6.6.0",
35-
"babel-preset-es2015-loose": "^7.0.0",
36+
"babel-preset-es2015-loose": "^8.0.0",
3637
"babel-preset-react": "^6.5.0",
3738
"babel-preset-stage-0": "^6.5.0",
38-
"eslint-plugin-react": "^5.0.1",
39+
"eslint-plugin-react": "^6.10.0",
3940
"react-hot-loader": "^1.3.0",
40-
"webpack": "^1.13.0",
41-
"webpack-dev-server": "^1.14.1"
41+
"webpack": "^2.2.1",
42+
"webpack-dev-server": "^2.4.1"
4243
},
4344
"dependencies": {
4445
"immutable": "^3.8.1",
4546
"react": "^15.0.1",
46-
"react-base16-styling": "^0.2.2",
47+
"react-base16-styling": "^0.4.7",
4748
"react-dom": "^15.0.1"
4849
}
4950
}

Diff for: examples/webpack.config.js

+21-12
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,50 @@
11
var path = require('path');
22
var webpack = require('webpack');
33

4+
var isProduction = process.env.NODE_ENV === 'production';
5+
46
module.exports = {
5-
devtool: 'eval',
7+
devtool: 'source-map',
68
entry: [
7-
'webpack-dev-server/client?http://localhost:3000',
8-
'webpack/hot/only-dev-server',
9+
!isProduction && 'webpack-dev-server/client?http://localhost:3000',
10+
!isProduction && 'webpack/hot/only-dev-server',
911
'./src/index'
10-
],
12+
].filter(Boolean),
1113
output: {
1214
path: path.join(__dirname, 'dist'),
1315
filename: 'bundle.js',
1416
publicPath: '/static/'
1517
},
1618
plugins: [
19+
new webpack.DefinePlugin({
20+
'process.env': {
21+
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
22+
}
23+
}),
1724
new webpack.HotModuleReplacementPlugin(),
18-
new webpack.NoErrorsPlugin()
19-
],
25+
new webpack.NoEmitOnErrorsPlugin(),
26+
isProduction && new webpack.optimize.UglifyJsPlugin({
27+
compress: { warnings: false },
28+
output: { comments: false },
29+
sourceMap: true
30+
})
31+
].filter(Boolean),
2032
resolve: {
2133
alias: {
2234
'react-json-tree/lib': path.join(__dirname, '..', 'src'),
2335
'react-json-tree': path.join(__dirname, '..', 'src'),
2436
'react': path.join(__dirname, 'node_modules', 'react')
2537
},
26-
extensions: ['', '.js']
27-
},
28-
resolveLoader: {
29-
'fallback': path.join(__dirname, 'node_modules')
38+
extensions: ['.js']
3039
},
3140
module: {
3241
loaders: [{
3342
test: /\.js$/,
34-
loaders: ['react-hot', 'babel'],
43+
loaders: [!isProduction && 'react-hot-loader', 'babel-loader'].filter(Boolean),
3544
include: path.join(__dirname, 'src')
3645
}, {
3746
test: /\.js$/,
38-
loaders: ['react-hot', 'babel'],
47+
loaders: [!isProduction && 'react-hot-loader', 'babel-loader'].filter(Boolean),
3948
include: path.join(__dirname, '..', 'src')
4049
}]
4150
}

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"scripts": {
77
"clean": "rimraf lib",
88
"build": "babel src --out-dir lib",
9-
"lint": "eslint --max-warnings=0 src test examples",
9+
"lint": "eslint --max-warnings=0 src test examples/src",
1010
"test": "npm run lint && NODE_ENV=test mocha --compilers js:babel-core/register --recursive",
1111
"test:watch": "NODE_ENV=test mocha --compilers js:babel-core/register --recursive --watch",
1212
"test:cov": "babel-node ./node_modules/.bin/isparta cover ./node_modules/.bin/_mocha -- --recursive",

0 commit comments

Comments
 (0)