I am creating a web site with Angular2@2.1.2. I am using Webpack with default settings (as a dependency).
Here is my package.json
\"dependencies\": {
I made this work with Angular6.
Place your robots.txt in the src folder, the same folder as the favicon.ico.
In your angular.json file
"assets": [
"src/favicon.ico",
"src/assets",
"src/robots.txt"
],
You may need to ng serve again, then point to http://localhost:4200/robots.txt
This will only work if you are not catching all unknown routes (path:'**') in your router module(s).