Commit a1776b3b authored by ZeHiro's avatar ZeHiro Committed by ZeHiro
Browse files

Improve minification for production build. fixes #591

parent a1514133
......@@ -36,8 +36,10 @@
"babelify": "7.3.0",
"bootstrap-kresus": "0.0.4",
"browserify": "14.1.0",
"bundle-collapser": "1.2.1",
"c3": "0.4.11",
"dygraphs": "2.0.0",
"envify": "4.0.0",
"eslint": "3.17.0",
"eslint-plugin-import": "2.2.0",
"eslint-plugin-react": "6.10.0",
......@@ -59,6 +61,7 @@
"redux-thunk": "2.2.0",
"semver": "5.3.0",
"should": "11.2.0",
"uglifyify": "3.0.4",
"updeep": "1.0.0",
"watchify": "3.9.0"
},
......
#!/bin/bash
# Default to development
if [ -z "$NODE_ENV" ]
then
NODE_ENV="development"
fi
echo "Building in $NODE_ENV mode..."
rm -rf ./build/
echo "Copying static files..."
......@@ -19,8 +26,18 @@ mkdir -p ./build/client/js
./scripts/build-vendor-js.sh
echo "Building client JS..."
# Only remove developement imports and long package ids on production
if [ "$NODE_ENV" = "production" ]
then
SUPP_PRODUCTION_BUILD_ARGS="-g uglifyify \
-p bundle-collapser/plugin"
fi
./node_modules/browserify/bin/cmd.js ./client/main.js -v \
-t [ babelify --presets es2015,react --plugins transform-runtime ] \
-g [ envify --NODE_ENV $NODE_ENV ] \
$SUPP_PRODUCTION_BUILD_ARGS \
-o ./build/client/js/main.js
echo "Copying shared files..."
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment