Several errors while building app with –prod flag

Bug Report or Feature Request (mark with an x)
- [ ] Regression (a behavior that used to work and stopped working in a new release)
- [x] Bug report -> please search issues before submitting
- [ ] Feature request
- [ ] Documentation issue or request

When I try to build my app for production, I get the following errors:
image

I’m using the 6.3.2 version.

I’m importing it on a shared module, and exporting it to the other modules:
image

Even if I don’t use it on any component/page, I get the error just from importing it.

Weird things:

  • It was working at least until last week (last successful deploy);
  • It works on Windows machines, but I get these error in Linux environments;

Searched a lot and got nothing.

Any help?

Thanks in advance.

4 thoughts on “Several errors while building app with –prod flag

  1. I got this error today as well.

    It looks like the “latest” version of the pdfjs-dist npm went from version 2.5.207 to 2.6.347 a day ago.

    Setting pdfjs-dist back to the previous version fixed the errors for me i.e. add this line to your package.json dependencies:
    "pdfjs-dist": "2.5.207",

  2. I got the same issue, adding "pdfjs-dist": "2.5.207", to package.json with npm solved my issue, what I did exactly is I added this and removed the package-lock.json file and node_modules folder, then I did run npm i, that did fix my issue.

  3. I got the same issue, Need to add a dependencies library, and the issue will be fixed for me.
    "@types/pdfjs-dist": "~2.0.1", "ng2-pdf-viewer": "^6.3.2"

    OR else decrease ng2-pdf-viewer version number and add pdfjs-dist
    "pdfjs-dist": "~2.5.207", "ng2-pdf-viewer": "~5.3.4",