'How to prevent Angular/Webpack leaving references to dev directories on production code

Angular/Webpack is leaving "comments" on production (dist folder) code referencing development directories which include my username.

Example:

  • main.js:

module.exports = webpack_require(/*! C:\Users\cristian.abelleira\myproject\src\main.ts */"./src/main.ts");

How can I prevent this behaviour?

Note: I used "ng build" command to generate /dist folder

angular.js: https://gist.github.com/CrAbelleira/11c2eb2d25ade5a7ac7bf34d0b8e7952



Solution 1:[1]

I found the problem. It was a misconfiguration that was preventing the command "ng build --configuration production" to be executed with the "--configuration production" flag properly.

After compiling with this flag, the references dissapeared.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Cristian Abelleira