I had a very similar scenario, since I didn't want to copy the assets folder when building using aot.After finding this article, I ended up duplicating my app config at the .angular-cli.json, each one with its unique name (in my case devApp and aotApp) like this:"$schema": "./node_modules/@angular/cli/lib/config/schema.json","project": { "name": "my-project"},"apps": [ { "name": "devApp", "root": "src", "outDir": "wwwroot", "assets": [ "assets", "favicon.ico" ], "index": "index.html", "main": "main.ts", "polyfills": "polyfills.ts", "test": "test.ts", "tsconfig": "tsconfig.app.json", "testTsconfig": "tsconfig.spec.json", "prefix": "app", "styles": [ "styles.scss" ], "scripts": [ ], "environmentSource": "environments/environment.ts", "environments": { "dev": "environments/environment.ts", "prod": "environments/environment.prod.ts" } } , { "name": "aotApp", "root": "src", "outDir": "wwwroot", "assets": [ ], "index": "index.html", "main": "main.ts", "polyfills": "polyfills.ts", "test": "test.ts", "tsconfig": "tsconfig.app.json", "testTsconfig": "tsconfig.spec.json", "prefix": "app", "styles": [ "styles.scss" ], "scripts": [ ], "environmentSource": "environments/environment.ts", "environments": { "dev": "environments/environment.ts", "prod": "environments/environment.prod.ts" } }],--- and then the rest of the configuration所以...要开发,我使用ng serve --app devApp(尽管似乎ng serve也可以使用),当我需要生成用于生产的捆绑包时,我运行ng build --app aotApp --prod.So... to develop I use ng serve --app devApp (although It seems that just ng serve also works), and when I need to generate the bundles for production, I run ng build --app aotApp --prod. 这篇关于忽略ng build --prod中的`assets`文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-20 19:20