3

I tried to run angular app in production mode ng serve --aot --prod. When the app is launched, I see an error in console, but the error stack trace is obfuscated and I cannot find the source code which causes the error. Without --prod option, there are no errors. How I can find the error source?

main.026c3ce7721e9ba03a1e.js:1 ERROR TypeError: f.ngOnInit is not a function
    at main.026c3ce7721e9ba03a1e.js:1
    at main.026c3ce7721e9ba03a1e.js:1
    at Ji (main.026c3ce7721e9ba03a1e.js:1)
    at Eo (main.026c3ce7721e9ba03a1e.js:1)
    at Object.updateDirectives (main.026c3ce7721e9ba03a1e.js:1)
    at Object.updateDirectives (main.026c3ce7721e9ba03a1e.js:1)
    at $i (main.026c3ce7721e9ba03a1e.js:1)
    at so (main.026c3ce7721e9ba03a1e.js:1)
    at oo (main.026c3ce7721e9ba03a1e.js:1)
    at $i (main.026c3ce7721e9ba03a1e.js:1)
1
  • 2
    use the --source-maps true option when compiling Commented Jul 19, 2018 at 11:30

1 Answer 1

2

Enable sourceMap in anuglar.json config file to see original code stack trace.

{
  "projects": {
    "myProject": {
      "architect": {
        "build": {
          "configurations": {
            "production": {
              "sourceMap": true
            }
          }
        }
      }
    }
  }
}

I also tried to add --source-map option to serve command, but the option didn't solve my problem for some reason.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.