这是我的电脑:
项目越大,我等待加载的时间就越长。真的毁了我的开发者体验。有没有办法可以为 vs 代码分配更多资源,使其运行得更快?我可以做任何优化来使其工作吗?
尝试的解决方案:
示例项目结构:
角度版本:
@angular-devkit/architect 0.803.22
@angular-devkit/build-angular 0.803.22
@angular-devkit/build-optimizer 0.803.22
@angular-devkit/build-webpack 0.803.22
@angular-devkit/core 8.3.22
@angular-devkit/schematics 8.3.22
@angular/cli 8.3.22
@angular/fire 5.3.0
@ngtools/webpack 8.3.22
@schematics/angular 8.3.22
@schematics/update 0.803.22
rxjs 6.4.0
typescript 3.5.3
webpack 4.39.2
Run Code Online (Sandbox Code Playgroud)
1.什么是'服务器错误。证书已过期'是什么意思?
2. 我该如何解决?
~~~~编辑~~~~
我有一个正在尝试调试的角度项目,但是,当我进行调试过程时,它会进入 @angular/core 和 ts-lib 。这些是包含很多步骤的巨大文件。有没有办法跳过外部代码?
这是我的 launch.json:
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:4200/silverlakeopc",
"webRoot": "${workspaceFolder}",
"skipFiles": ["!**/node_modules/**"]
}
]
Run Code Online (Sandbox Code Playgroud)
}
当我添加“skipFiles”行时,它现在会跳过我的所有代码。我只是想跳过外部库。
我努力了:
我有一个可以看起来像这样的对象:
{ageTop:42}
Run Code Online (Sandbox Code Playgroud)
或者像这样:
{locations: [{name:Myrtle Beach}]}
Run Code Online (Sandbox Code Playgroud)
这些对象作为参数传递给函数。(我试图确保该函数只获取它可以使用的类型,可能有其中之一,可能有其中两个,也可能没有)
我想出的解决方案如下:
我已经像这样定义了接口:
interface locationsType {
locations: Array<{name: string}>
}
interface ageTopType {
ageTop: number
}
type keyType = 'ageTop' | 'locations'
Run Code Online (Sandbox Code Playgroud)
我强制执行这样一个事实:如果选择了位置,我们将通过代码中的约定使用locationsType 接口,我相信当某人(或我自己)违反约定时,这会导致错误。我如何通过打字来强制执行此操作?基本上我想创建一些简单的逻辑:
interface traitType {
key: keyType
value: this.key === 'locations' ? locationsType : ageTopType;
}
class Developer {
locations: []
ageTop;
constructor(ageTop,locations) {
this.ageTop = ageTop
locations.forEach(_val => this.locations.push(_val))
}
loadTrait(trait:TraitType) {
if(trait.key === location) {
this.trait.value.forEach(_val => this.locations.push(_val)
return
}
this[trait.key] = trait.value;
}
}
Run Code Online (Sandbox Code Playgroud)
上面的方法都试过了,还是不行,哈哈。有什么见解吗?
我有一个较旧的 angular 项目,其中已经制作了一些组件。angular 语言服务不适用于使用 cli 生成的新组件,
但是,如果您查看几天前生成的同一项目中的另一个组件,它会起作用:
[![工作][1]](https://i.stack.imgur.com/9qFED.png)
我认为这是一个 IVY 问题,所以我继续在 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": …Run Code Online (Sandbox Code Playgroud)