Skip to content

Instantly share code, notes, and snippets.

@boyswan
Created May 3, 2019 16:19
Show Gist options
  • Save boyswan/95db668b2e5c3074309ccdfcc3ba9108 to your computer and use it in GitHub Desktop.
Save boyswan/95db668b2e5c3074309ccdfcc3ba9108 to your computer and use it in GitHub Desktop.
#!/bin/sh
#
COMMAND="build"
USAGE="
Usage: bundle application [-w] [-h] \n\n
-w watch for file changes and rebuild the bundle \n
-h help \n
"
while getopts "wh" opt; do
case $opt in
w)
COMMAND=watch
;;
h)
echo "$USAGE" 1>&2
exit 1
;;
esac
done
shift "$((OPTIND - 1))"
echo "bundler ${COMMAND}ing..."
fpack $COMMAND --development ./src/Index.bs.js \
-o ./public/scripts \
--name "main.bundle.js" \
--nm "$(pwd)" \
--nm "$(pwd)/node_modules" \
--nm node_modules \
--preprocess='^node_modules/@dexda.+\.js$:babel-loader?filename=.babelrc' \
--preprocess='^src.[^\.]+\.js$:babel-loader?filename=.babelrc' \
--preprocess='.css$:style-loader!css-loader'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment