Angular2 + webpack do not deploy robots.txt

后端 未结 3 1570
北海茫月
北海茫月 2020-12-31 02:33

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\": {         


        
3条回答
  •  攒了一身酷
    2020-12-31 02:52

    I have found my solution in this issue: https://github.com/angular/angular-cli/issues/1942

    robots.txt is in src/ directory
    Modify angular-cli.json

    "apps": [
    {
      "root": "src",
      "outDir": "dist",
      "assets": ["assets", "robots.txt"],
     ....
    

    Use the assets array to declare files you want to be placed in the root of dist/

提交回复
热议问题