Skip to content
This repository was archived by the owner on Apr 11, 2019. It is now read-only.

Commit c838dfd

Browse files
committed
Feat: add production webpack config and run deploy to test
1 parent e5e9ef3 commit c838dfd

File tree

7 files changed

+63
-24
lines changed

7 files changed

+63
-24
lines changed

config/templates/_index.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv=X-UA-Compatible content="IE=edge">
6+
<meta name="viewport" content="width=device-width,initial-scale=1">
7+
<title>Scalable React Boilerplate</title>
8+
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,700|Raleway:400,300,700|Lato:400,300,700' rel='stylesheet' type='text/css'>
9+
</head>
10+
<body>
11+
<!-- The app will bootstrap into this div -->
12+
<div id="app"></div>
13+
14+
</body>
15+
</html>

index.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
<!doctype html>
2-
<!doctype html>
32
<html lang="en">
43
<head>
54
<meta charset="UTF-8">
65
<meta http-equiv=X-UA-Compatible content="IE=edge">
7-
<meta name=viewport content="width=device-width,initial-scale=1">
6+
<meta name="viewport" content="width=device-width,initial-scale=1">
87
<title>Scalable React Boilerplate</title>
98
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,700|Raleway:400,300,700|Lato:400,300,700' rel='stylesheet' type='text/css'>
109
</head>

package.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
"test": {
1515
"plugins": [
1616
[
17-
"babel-plugin-webpack-loaders",
18-
{
17+
"babel-plugin-webpack-loaders", {
1918
"config": "./config/testing/webpack.test.config.js",
2019
"verbose": false
2120
}
@@ -40,18 +39,17 @@
4039
"configFile": "./config/webpack/webpack.test.config.js"
4140
},
4241
"scripts": {
43-
"t": "BABEL_DISABLE_CACHE=1 NODE_ENV=test node --harmony_proxies node_modules/.bin/jest",
42+
"t": "npm run test",
4443
"test:watch": "npm test -- --watch",
45-
"test": "npm run t",
44+
"test": "BABEL_DISABLE_CACHE=1 NODE_ENV=test node --harmony_proxies node_modules/.bin/jest",
4645
"build": "webpack",
4746
"dev": "webpack-dev-server",
4847
"generate": "plop --plopfile config/generators/index.js",
49-
"generator": "npm run generate",
5048
"generate:component": "plop --plopfile config/generators/index.js component",
5149
"generate:container": "plop --plopfile config/generators/index.js container",
5250
"generate:page": "plop --plopfile config/generators/index.js page",
5351
"lint": "eslint . --ext .js --ext .jsx; exit 0",
54-
"deploy": "cross-env NODE_ENV=production webpack -p",
52+
"deploy": "cross-env NODE_ENV=production webpack",
5553
"start": "npm run dev",
5654
"clean": "rm -rf app/dist app/build",
5755
"setup": "npm install",
@@ -92,6 +90,7 @@
9290
"expect": "^1.20.2",
9391
"expect-jsx": "^2.6.0",
9492
"express": "^4.14.0",
93+
"extract-text-webpack-plugin": "^1.0.1",
9594
"file-loader": "^0.9.0",
9695
"foundation-sites": "^6.2.3",
9796
"grommet": "^0.6.10",

server/public/index.html

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1 @@
1-
<!doctype html>
2-
<html lang="en">
3-
<head>
4-
<meta charset="UTF-8">
5-
<meta http-equiv=X-UA-Compatible content="IE=edge">
6-
<meta name=viewport content="width=device-width,initial-scale=1">
7-
<title>Scalable React Boilerplate</title>
8-
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,700|Raleway:400,300,700|Lato:400,300,700' rel='stylesheet' type='text/css'>
9-
</head>
10-
<body>
11-
<!-- The app will bootstrap into this div -->
12-
<div id="app"></div>
13-
<script type="text/javascript" src="/bundle.js"></script>
14-
</body>
15-
</html>
1+
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Scalable React Boilerplate</title><link href="https://fonts.googleapis.com/css?family=Open+Sans:400,300,700|Raleway:400,300,700|Lato:400,300,700" rel="stylesheet"></head><body><div id="app"></div><script type="text/javascript" src="/vendor.26f395b8adac3b23a24c.js"></script><script type="text/javascript" src="/main.1e58d1cb696f4b75ca7b.js"></script></body></html>

server/public/main.1e58d1cb696f4b75ca7b.js

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/public/vendor.26f395b8adac3b23a24c.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webpack.config.babel.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import path from 'path';
33
import HtmlwebpackPlugin from 'html-webpack-plugin';
44
import NpmInstallPlugin from 'npm-install-webpack-plugin';
55
import Visualizer from 'webpack-visualizer-plugin';
6+
const ExtractTextPlugin = require('extract-text-webpack-plugin');
7+
68
const ROOT_PATH = path.resolve(__dirname);
79
const env = process.env.NODE_ENV || 'development';
810
const isProduction = env === 'production';
@@ -81,7 +83,11 @@ module.exports = {
8183
:
8284
path.resolve(ROOT_PATH, 'app/build'),
8385
publicPath: '/',
84-
filename: 'bundle.js',
86+
filename: isProduction ? '[name].[chunkhash].js' : 'bundle.js',
87+
chunkFilename: '[name].[chunkhash].chunk.js',
88+
},
89+
stats: {
90+
chunks: isProduction,
8591
},
8692
devServer: {
8793
contentBase: path.resolve(ROOT_PATH, 'app/build'),

0 commit comments

Comments
 (0)