angular - How to exclude a sub-application from web-pack bundle during build time in Angular
问题描述
Following studying following blog:
I created three applications : mainApp,subApp1,subapp2.
SubApp1 and subApp2 applications are created inside the project directory of the main project (using ng g application subApp1 --routing=true command).
And I am able to run the applications successfully.
But my need, which is slightly different from the blog is that, the sub applications need not to be independent but act like an optional project (created specifically for different optional features/functionality) with some specific components which I have to use in the main project.
And also these sub applications have no relevance without the main app. As there could be multiple scenarios as follows:
- Main App will use only component from SubApp1.
- Main App will use only component from SubApp2. Or
- Main App will use both Sub apps or none of them.
I want that, after the build of the project, I am able to bunde that sub application in web-pack bundle whose components are will be used in the main application.Need is to exclude the sub application from dist folder when not required.
From some similar questions asked I did following actions, for example :
- Change in the tsconfig.app.json file : adding the sub -applications in exclude parameter :
"exclude": [
"src/test.ts",
"src/**/*.spec.ts",
"projects/subApp1"
]
- Change in angular.json : adding the path of sub application in exclude parameters of lint option.
But I still get modules made in subApps in dist folder after the build.
Let me know if there is some corrections to be done in above steps or any other approach.
解决方案
推荐阅读
- android - 模拟器:模拟器:错误:缺少初始数据分区文件
- ios - 用于 swift4 ios 的 Socket.io
- jsf-2 - Websphere Application Server 9 Tomahawk20 中的 Popupcalendar
- android - Xamarin android 版本在一个包中包含多个 c++ abis?
- android - 更新由包安装程序安装的应用程序
- c - 查找数组表示中数字的模数和除数
- bash - Bash 函数将确保一个数字 (n) 可以被其他两个数字 (x) 和 (y) 整除
- python - 带有置信区间和引导程序的熊猫箱线图返回异常 - 鸢尾花数据集的可重现示例
- php - 通过在 PHP 中执行算术运算来更改数组内容的顺序
- byobu - Byobu 终端窗口名称星号 Z