Angular项目中找不到src/environments文件夹的问题咨询
为什么Angular新项目没有src/environments目录?
参考多篇教程,都提到“请前往src/environments目录”,但我的项目里完全没有这个文件夹!删除整个项目重新创建后,问题依然存在。
我的操作步骤如下:
1. cd my_path 2. npm install -g @angular/cli 3. ng new webversion --> Angular routing? Yes --> Stylesheet: CSS 4. cd webversion 5. npm install bootstrap 6. npm install firebase @angular/fire
此时教程开始使用src/environments,但我的项目中没有该文件夹。以下是我的angular.json配置:
{ "$schema": "./node_modules/@angular/cli/lib/config/schema.json", "version": 1, "newProjectRoot": "projects", "projects": { "webversion": { "projectType": "application", "schematics": {}, "root": "", "sourceRoot": "src", "prefix": "app", "architect": { "build": { "builder": "@angular-devkit/build-angular:browser", "options": { "outputPath": "dist/webversion", "index": "src/index.html", "main": "src/main.ts", "polyfills": [ "zone.js" ], "tsConfig": "tsconfig.app.json", "assets": [ "src/favicon.ico", "src/assets" ], "styles": [ "src/styles.css" ], "scripts": [] }, "configurations": { "production": { "budgets": [ { "type": "initial", "maximumWarning": "500kb", "maximumError": "1mb" }, { "type": "anyComponentStyle", "maximumWarning": "2kb", "maximumError": "4kb" } ], "outputHashing": "all" }, "development": { "buildOptimizer": false, "optimization": false, "vendorChunk": true, "extractLicenses": false, "sourceMap": true, "namedChunks": true } }, "defaultConfiguration": "production" }, "serve": { "builder": "@angular-devkit/build-angular:dev-server", "configurations": { "production": { "browserTarget": "webversion:build:production" }, "development": { "browserTarget": "webversion:build:development" } }, "defaultConfiguration": "development" }, "extract-i18n": { "builder": "@angular-devkit/build-angular:extract-i18n", "options": { "browserTarget": "webversion:build" } }, "test": { "builder": "@angular-devkit/build-angular:karma", "options": { "polyfills": [ "zone.js", "zone.js/testing" ], "tsConfig": "tsconfig.spec.json", "assets": [ "src/favicon.ico", "src/assets" ], "styles": [ "src/styles.css" ], "scripts": [] } } } } } }
根据教程,该配置文件应包含对environment文件夹的引用,以及生产模式下的文件替换信息,但我的配置里两者都没有...
请问我遗漏了什么?
内容的提问来源于stack exchange,提问作者lukasniessen
相关产品推荐
相关产品推荐

