• angular 6 爬坑之旅


      自从2018年5月份,angular 6发布之后,相信用过angualr6的小伙伴一定和我一样,爬了很多坑了吧!下面把我爬过的坑总结一下:

      一.angular6 引入ng-zorro,没有样式。。。

       解决:在angular.josn文件中,添加 "node_modules/ng-zorro-antd/src/ng-zorro-antd.min.css"

          

     "styles": [
                  "node_modules/ng-zorro-antd/src/ng-zorro-antd.min.css",
                  "src/styles.css"
                ],

      二. angular配置proxy代理文件无效。。。

        解决:在package.json文件中,添加配置项"start": "ng s --proxy-config proxy.config.json --open",

      

    "scripts": {
        "ng": "ng",
        "start": "ng s --proxy-config proxy.config.json  --open",
        "build": "ng build",
        "test": "ng test",
        "lint": "ng lint",
        "e2e": "ng e2e"
      },

      三、augular配置环境打包命令

        解决方法,直接上代码吧

        

     "configurations": {
                "production": {
                  "fileReplacements": [
                    {
                      "replace": "src/environments/environment.ts",
                      "with": "src/environments/environment.prod.ts"
                    }
                  ],
                  "optimization": true,
                  "outputHashing": "all",
                  "sourceMap": false,
                  "extractCss": true,
                  "namedChunks": false,
                  "aot": true,
                  "extractLicenses": true,
                  "vendorChunk": false,
                  "buildOptimizer": true
                },
                "test": {
                "fileReplacements": [
                     {
                        "replace": "src/environments/environment.ts",
                        "with": "src/environments/environment.test.ts"
                      }
                    ],
                    "optimization": true,
                    "outputHashing": "all",
                    "sourceMap": false,
                    "extractCss": true,
                    "namedChunks": false,
                    "aot": true,
                    "extractLicenses": true,
                    "vendorChunk": false,
                    "buildOptimizer": true
                }
              }
            },
    

      研发环境打包命令:ng build

      测试环境打包命令:ng build --configuration=production

      正式环境打包命令:ng build --configuration=test

  • 相关阅读:
    smtplib.py
    淘宝链接中的spm参数
    with 上下文管理
    python RecursionError: maximum recursion depth exceeded while calling
    GraphQL两年实战
    Exception 异常处理
    Simple decorator that intercepts connection errors and ignores these if settings specify this.
    namedtuple
    服务治理在猫眼娱乐的演进之路
    路由、限流、熔断 微服务治理
  • 原文地址:https://www.cnblogs.com/sun-web/p/9678934.html
Copyright © 2020-2023  润新知