Skip to content

Instantly share code, notes, and snippets.

@viankakrisna
Created July 14, 2017 03:40
Show Gist options
  • Save viankakrisna/b7720c21ad0e046c7a20e2c6e85b14d5 to your computer and use it in GitHub Desktop.
Save viankakrisna/b7720c21ad0e046c7a20e2c6e85b14d5 to your computer and use it in GitHub Desktop.
function verify_uglifyjs_error {
# Create stub dependency
echo "module.exports = class {}" >> node_modules/es6-sample.js
# Save App.js, we're going to modify it
cp src/App.js src/App.js.bak
# Add an es6 dependency
echo "import es6 from 'es6-sample'" | cat - src/App.js > src/App.js.temp && mv src/App.js.temp src/App.js
if `npm run build` | grep -xqFe "Failed to minify the code from this file:
./~/es6-sample.js line 1:0
Read more here: http://bit.ly/2tRViJ9"
then
echo "matched"
else
exit 1
fi
# Restore App.js
rm src/App.js
mv src/App.js.bak src/App.js
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment