Skip to content

Commit 3dd6b25

Browse files
committed
add gh-pages script, remove uglify, set output destination based on node env
1 parent a00f3ba commit 3dd6b25

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"main": "index.js",
1010
"scripts": {
1111
"dev": "webpack --progress --colors --watch",
12-
"dev-server": "node ./examples/parallax-example/dist/server"
12+
"dev-server": "node ./examples/parallax-example/dist/server",
13+
"gh-pages": "NODE_ENV=production webpack --progress --colors"
1314
},
1415
"keywords": [
1516
"react",

webpack.config.js

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,18 @@ const path = require('path');
44
const webpack = require('webpack');
55
const createBabelConfig = require('./babelrc');
66
const nodeExternals = require('webpack-node-externals');
7-
const MinifierPlugin = webpack.optimize.UglifyJsPlugin;
87

98
const exampleRoot = './examples/parallax-example/';
109

1110
const clientConfig = {
1211
entry: path.resolve(exampleRoot + 'client.js'),
1312
output: {
14-
path: path.resolve(exampleRoot + 'dist'),
13+
path: path.resolve(
14+
PRODUCTION ? exampleRoot + 'static' : exampleRoot + 'dist'
15+
),
1516
filename: 'bundle.js',
1617
},
1718

18-
plugins: [
19-
PRODUCTION && new MinifierPlugin(),
20-
].filter(e => e),
21-
2219
resolve: {
2320
alias: {
2421
'react-scroll-parallax': path.resolve('./src'),
@@ -84,14 +81,12 @@ const serverConfig = {
8481

8582
entry: path.resolve(exampleRoot + 'server.js'),
8683
output: {
87-
path: path.resolve(exampleRoot + 'dist'),
84+
path: path.resolve(
85+
PRODUCTION ? exampleRoot + 'static' : exampleRoot + 'dist'
86+
),
8887
filename: 'server.js',
8988
},
9089

91-
plugins: [
92-
PRODUCTION && new MinifierPlugin(),
93-
].filter(e => e),
94-
9590
resolve: {
9691
alias: {
9792
'react-scroll-parallax': path.resolve('./src'),
@@ -135,4 +130,4 @@ const serverConfig = {
135130
},
136131
};
137132

138-
module.exports = [clientConfig, serverConfig];
133+
module.exports = PRODUCTION ? [clientConfig] : [clientConfig, serverConfig];

0 commit comments

Comments
 (0)