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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.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 langage服务在与cli生成的新组件的vs代码中不工作_Angular_Visual Studio Code_Angular Language Service - Fatal编程技术网

Angular langage服务在与cli生成的新组件的vs代码中不工作

Angular langage服务在与cli生成的新组件的vs代码中不工作,angular,visual-studio-code,angular-language-service,Angular,Visual Studio Code,Angular Language Service,我有一个旧的角度项目与一些组件已经作出。angular语言服务不适用于使用cli生成的新组件 今天生成的新组件: 然后是ts文件: 但是,如果您查看几天前生成的同一项目中的另一个组件,它可以工作: [ ts文件: 我认为这是一个常春藤问题,所以我继续在angular.json中禁用AOT,并在我的ts配置中添加了“enableIvy”:false,以下是这些文件: Angular.json { "$schema": "./node_modules/@an

我有一个旧的角度项目与一些组件已经作出。angular语言服务不适用于使用cli生成的新组件

今天生成的新组件: 然后是ts文件:

但是,如果您查看几天前生成的同一项目中的另一个组件,它可以工作:

[

ts文件:

我认为这是一个常春藤问题,所以我继续在angular.json中禁用AOT,并在我的ts配置中添加了“enableIvy”:false,以下是这些文件:

Angular.json

{
    "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
    "version": 1,
    "newProjectRoot": "projects",
    "projects": {
        "frontend": {
            "projectType": "application",
            "schematics": {
                "@schematics/angular:component": {
                    "style": "scss"
                }
            },
            "root": "",
            "sourceRoot": "src",
            "prefix": "app",
            "architect": {
                "build": {
                    "builder": "@angular-devkit/build-angular:browser",
                    "options": {
                        "outputPath": "dist/frontend",
                        "index": "src/index.html",
                        "main": "src/main.ts",
                        "polyfills": "src/polyfills.ts",
                        "tsConfig": "tsconfig.app.json",
                        "aot": false,
                        "assets": ["src/favicon.ico", "src/assets"],
                        "styles": [
                            "src/styles.scss",
                            "node_modules/material-design-icons/iconfont/material-icons.css"
                        ],
                        "scripts": []
                    },
                    "configurations": {
                        "production": {
                            "fileReplacements": [
                                {
                                    "replace": "src/environments/environment.ts",
                                    "with": "src/environments/environment.prod.ts"
                                }
                            ],
                            "optimization": true,
                            "outputHashing": "all",
                            "sourceMap": false,
                            "extractCss": true,
                            "namedChunks": false,
                            "extractLicenses": true,
                            "vendorChunk": false,
                            "buildOptimizer": true,
                            "budgets": [
                                {
                                    "type": "initial",
                                    "maximumWarning": "2mb",
                                    "maximumError": "5mb"
                                },
                                {
                                    "type": "anyComponentStyle",
                                    "maximumWarning": "6kb",
                                    "maximumError": "10kb"
                                }
                            ]
                        }
                    }
                },
                "serve": {
                    "builder": "@angular-devkit/build-angular:dev-server",
                    "options": {
                        "browserTarget": "frontend:build"
                    },
                    "configurations": {
                        "production": {
                            "browserTarget": "frontend:build:production"
                        }
                    }
                },
                "extract-i18n": {
                    "builder": "@angular-devkit/build-angular:extract-i18n",
                    "options": {
                        "browserTarget": "frontend:build"
                    }
                },
                "test": {
                    "builder": "@angular-devkit/build-angular:karma",
                    "options": {
                        "main": "src/test.ts",
                        "polyfills": "src/polyfills.ts",
                        "tsConfig": "tsconfig.spec.json",
                        "karmaConfig": "karma.conf.js",
                        "assets": [
                            "src/favicon.ico",
                            "src/assets",
                            {
                                "glob": "**/*",
                                "input": "node_modules/ngx-auth-firebaseui/assets/",
                                "output": "./assets/"
                            }
                        ],
                        "styles": [
                            "src/styles.scss",
                            "node_modules/material-design-icons/iconfont/material-icons.css"
                        ],
                        "scripts": []
                    }
                },
                "lint": {
                    "builder": "@angular-devkit/build-angular:tslint",
                    "options": {
                        "tsConfig": [
                            "tsconfig.app.json",
                            "tsconfig.spec.json",
                            "e2e/tsconfig.json"
                        ],
                        "exclude": ["**/node_modules/**"]
                    }
                },
                "e2e": {
                    "builder": "@angular-devkit/build-angular:protractor",
                    "options": {
                        "protractorConfig": "e2e/protractor.conf.js",
                        "devServerTarget": "frontend:serve"
                    },
                    "configurations": {
                        "production": {
                            "devServerTarget": "frontend:serve:production"
                        }
                    }
                }
            }
        }
    },
    "defaultProject": "frontend"
}
tsconfig.app.json

{
    "extends": "./tsconfig.base.json",
    "compilerOptions": {
        "outDir": "./out-tsc/app",
        "types": []
    },
    "files": ["src/main.ts", "src/polyfills.ts"],
    "include": ["src/**/*.d.ts"],
    "angularCompilerOptions": {
        "enableIvy": false
    }
}
tsconfig.json:

{
  "files": [],
  "references": [
    {
      "path": "./tsconfig.app.json"
    },
    {
      "path": "./tsconfig.spec.json"
    }
]
}
tsconfig.base.json

{
    "compileOnSave": false,
    "compilerOptions": {
        "baseUrl": "./",
        "outDir": "./dist/out-tsc",

        "sourceMap": true,
        "declaration": false,
        "downlevelIteration": true,
        "experimentalDecorators": true,
        "moduleResolution": "node",
        "importHelpers": true,
        "target": "es2015",
        "module": "es2020",
        "lib": ["es2018", "dom"]
    }
}
编辑
我从头开始创建了一个全新的项目,问题似乎仅限于此项目。它适用于新项目中的新组件。只是在旧项目中不起作用

当我为项目服务时,我收到了这些我从未见过或理解的警告,尽管如此,project仍然编译:

WARNING in /Users/raphaelcastro/Documents/Programing/Development/partnerDataEntryProject/frontend/node_modules/@angular/fire/fesm2015/angular-fire-firestore.js depends on '@firebase/app'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

WARNING in /Users/raphaelcastro/Documents/Programing/Development/partnerDataEntryProject/frontend/node_modules/@angular/fire/fesm2015/angular-fire.js depends on 'firebase/app'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

WARNING in /Users/raphaelcastro/Documents/Programing/Development/partnerDataEntryProject/frontend/node_modules/ngx-auth-firebaseui/fesm2015/ngx-auth-firebaseui.js depends on '@firebase/auth'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

WARNING in /Users/raphaelcastro/Documents/Programing/Development/partnerDataEntryProject/frontend/node_modules/@angular/fire/fesm2015/angular-fire-firestore.js depends on '@firebase/firestore'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

我也遇到了同样的问题,vscode问我是否要启用实验常春藤,我点击了yes! 在我的头撞了24小时后,我不得不再次禁用它 墙

以下是方法:
我也遇到了同样的问题,在vscode询问我是否要启用实验常春藤后,我单击了“是”! 在我的头撞了24小时后,我不得不再次禁用它 墙

以下是方法: