Skip to content

Instantly share code, notes, and snippets.

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