1

I am trying to add angular to an existing legacy app, changing page/components one by one.

I am able to create custom elements using: createCustomElement as mentionned here: https://angular.io/guide/elements

But I want to create multiple components and have each one compiled in a different file + have all the shared (tree shaken) resources compiles in a separate file. ex:

  • dist
    • button.js
    • table.js (uses button but as custom element, not with import)
    • invoice.js
    • ...
    • angular.js (contains http Client, since used by table, but not http form since not used + customElement polyfill...)

When I want to only use buttons, my file.html only have script tags for angular.js and button.js

When I want to use tables I also add table.js ...

I found many articles, repos including : https://github.com/manfredsteyer/ngx-build-plus but it I couldn't split the chunks and just import the needed files and have it work

Any Idea on how to configure my project to this please? Thanks

Edit: It would be even better If I could have control to choose some of the components to add to the main angular.js since used by all the others (ex: include the button components with angular...)

user1928596
  • 1,503
  • 16
  • 21

0 Answers0