Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/31.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 8未使用ng2 adsense构建_Angular_Angular8_Adsense - Fatal编程技术网

Angular 8未使用ng2 adsense构建

Angular 8未使用ng2 adsense构建,angular,angular8,adsense,Angular,Angular8,Adsense,我使用谷歌Adsense libng2 Adsense为Angular应用程序显示我的广告 我遵循了以下步骤: 将adsbygoogle.js脚本添加到头部 将AdsenseModule添加到NgModuleimports数组中 将标记添加到我希望广告显示的app.component.html文件中 它在本地工作正常(当我运行ng run service时,不会显示严重错误) 当我尝试构建我的angular应用程序以分发到Firebase时,我得到以下错误 ng构建——prod 这不是一个永久的

我使用谷歌Adsense lib
ng2 Adsense
Angular
应用程序显示我的广告

我遵循了以下步骤:

  • adsbygoogle.js
    脚本添加到头部
  • AdsenseModule
    添加到
    NgModule
    imports数组中
  • 标记添加到我希望广告显示的app.component.html文件中
  • 它在本地工作正常(当我运行
    ng run service
    时,不会显示严重错误)

    当我尝试构建我的angular应用程序以分发到Firebase时,我得到以下错误

    ng构建——prod


    这不是一个永久的解决方案,但我通过在
    angular.json
    文件中将
    buildOptimizer
    更改为
    false
    临时修复了生产构建

                    "configurations": {
                            "production": {
                                "optimization": true,
                                "outputHashing": "all",
                                "sourceMap": false,
                                "extractCss": true,
                                "namedChunks": false,
                                "aot": true,
                                "extractLicenses": true,
                                "vendorChunk": false,
                                "buildOptimizer": false,
                                "fileReplacements": [
                                    {
                                        "replace": "src/environments/environment.ts",
                                        "with": "src/environments/environment.prod.ts"
                                    }
                                ],
                                "budgets": [
                                    {
                                        "type": "initial",
                                        "maximumWarning": "2mb",
                                        "maximumError": "5mb"
                                    }
                                ]
                            }
                        }
                    }, 
    
                    "configurations": {
                            "production": {
                                "optimization": true,
                                "outputHashing": "all",
                                "sourceMap": false,
                                "extractCss": true,
                                "namedChunks": false,
                                "aot": true,
                                "extractLicenses": true,
                                "vendorChunk": false,
                                "buildOptimizer": false,
                                "fileReplacements": [
                                    {
                                        "replace": "src/environments/environment.ts",
                                        "with": "src/environments/environment.prod.ts"
                                    }
                                ],
                                "budgets": [
                                    {
                                        "type": "initial",
                                        "maximumWarning": "2mb",
                                        "maximumError": "5mb"
                                    }
                                ]
                            }
                        }
                    },