Skip to content

Commit 067e32d

Browse files
thangngoc89chenglou
authored andcommitted
Added production ready settings for react theme (#2587)
* Added production ready settings for react theme Fixes 2579 Signed-Off-By: Khoa Nguyen <[email protected]> * Update package.json
1 parent 3f6f686 commit 067e32d

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

jscomp/bsb/templates/react/README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
# ${bsb:name}
22

3-
Run this project:
3+
## Run this project:
44

55
```
66
npm install
77
npm start
88
# in another tab
99
npm run webpack
1010
```
11-
1211
After you see the webpack compilation succeed (the `npm run webpack` step), open up the nested html files in `src/*` (**no server needed!**). Then modify whichever file in `src` and refresh the page to see the changes.
1312

1413
**For more elaborate ReasonReact examples**, please see https://github.com/reasonml-community/reason-react-example
14+
15+
## Build this project
16+
17+
```
18+
npm run build
19+
npm run webpack:build
20+
```
21+

jscomp/bsb/templates/react/bsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"subdirs" : true
1313
},
1414
"package-specs": [{
15-
"module": "commonjs",
15+
"module": "es6",
1616
"in-source": true
1717
}],
1818
"suffix": ".bs.js",

jscomp/bsb/templates/react/package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,22 @@
66
"start": "bsb -make-world -w",
77
"clean": "bsb -clean-world",
88
"test": "echo \"Error: no test specified\" && exit 1",
9-
"webpack": "webpack -w"
9+
"webpack": "webpack -w",
10+
"webpack:build": "NODE_ENV=production webpack"
1011
},
1112
"keywords": [
1213
"BuckleScript"
1314
],
1415
"author": "",
1516
"license": "MIT",
1617
"dependencies": {
17-
"react": "^15.4.2",
18-
"react-dom": "^15.4.2",
19-
"reason-react": ">=0.3.0"
18+
"react": "^16.2.0",
19+
"react-dom": "^16.2.0",
20+
"reason-react": ">=0.3.4"
2021
},
2122
"devDependencies": {
2223
"bs-platform": "^${bsb:bs-version}",
23-
"webpack": "^3.8.1"
24+
"webpack": "^4.0.1",
25+
"webpack-cli": "^2.0.10"
2426
}
2527
}

jscomp/bsb/templates/react/webpack.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
const path = require('path');
22
const outputDir = path.join(__dirname, "build/");
33

4+
const isProd = process.env.NODE_ENV === 'production';
5+
46
module.exports = {
57
entry: './src/Index.bs.js',
8+
mode: isProd ? 'production' : 'development',
69
output: {
710
path: outputDir,
811
publicPath: outputDir,

0 commit comments

Comments
 (0)