Open hardikpatel043 opened 4 years ago
Have you found a solution so far?
Very often this occurs if A depends on B and you only externalize A.
Thanks for the reply @manfredsteyer
No solution yet. I tried to externalize each package step by step based on error I got. It leads to externalized lot of internal packages from material and angular. It created very big list in webpack.external.js. I still was getting errors for some packages. So I didn't go further. Now we have another option of using webpack 5 module federation so trying that now.
Hello,
I faced the same issue as mentioned by @hardikpatel043. I want to externalize @angular/cdk/scrolling. But error ocurred saying "CdkVirtualScrollViewPort is neither 'ComponentType' or 'DirectiveType'". @manfredsteyer Can you please help?
Thanks In Advance
In my project, I have multiple micro apps. Each micro app is using angular material. So I am trying to externalize angular material package to make bundle size lighter.
For example, i have created a simple micro app which uses just MatButton. Here is my code
webpack.external.js
I created a bundle using below command. (package.json)
"build:aboutus:externals": "ng build --extra-webpack-config apps/aboutus/webpack.externals.js --output-hashing none --project aboutus --prod --single-bundle --stats-json"
For shell app to download required scripts for MatButton,
angular.json
Now when I build my micro app and run my shell app, i get below error
Note - Without MatButton, micro-app is working with shell app. So integration is good.
Here is github repo. https://github.com/hardikpatel043/mf-app/tree/externalize-material
Here, shell app = cz-app micro app = home