AOT compiler - include lazy loaded external module

后端 未结 2 1187
心在旅途
心在旅途 2021-02-10 03:15

I am trying to include external module (hosted in git/npm repository) as lazy-loaded module in my Angular application.

I am compiling my external module with ngc compile

2条回答
  •  花落未央
    2021-02-10 03:28

    maybe it's too late, but I hope this could help someone.

    I wrote a very simple node script to be run right after npm install. It is indeed a post install script. It copies source files from node_modules into a folder under the main project. It then updates references to lazy loaded modules in the main routes file.

    It worked perfectly for my team and we increased app performances very much.

    The script is short and well documented, please check it out

    https://gist.github.com/insanediv/8b4ebba06824a3eb8233e10287a1cdcd

提交回复
热议问题