Solvedangular ngSubmit when built with --prod flag not preventing form default behavior

I'm submitting a...

[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Feature request
[ ] Documentation issue or request

Current behavior

I've bumped in some strange error working on my project.
When I build it with --prod flag, (submit) and (ngSubmit) in my forms just stop preventing default form behavior and page reloads after submition.
Also, passing event and preventing it in onSubmit function won't give any result.
FormsModule and ReactiveFormsModule are imported.

When I build without --prod flag, everything works well

Any workarounds for this?

Expected behavior

Submitting form won't reload page.

Minimal reproduction of the problem with instructions

  1. Download Angular reactive form demo
  2. Run npm install / ng build --prod
  3. Open built app
  4. Try to submit form


Angular version: 4.3.1

Tested in Chrome and Firefox on Windows and Linux
20 Answers

✔️Accepted Answer

@GarryBrown, as suggested by @filipesilva in angular/angular-cli#8997, the problem seems to be related to uglify-es@3.3.2:

So, temporarily:

1 - add uglify-es@3.2.2 to dependencies array in package.json
2 - delete package-lock.json, node_modules and dist
3 - npm install

Or, to linux users:

npm i uglify-es@3.2.2 --save-exact && rm -rf package-lock.json node_modules && npm i && npm ls uglify-es

More Issues: