Webpack Lazy Loading with Typescript

后端 未结 3 1084
南笙
南笙 2021-01-23 00:19

I have a problem with lazy loading and webpack.

There is a video of Sean Larkin showing how easy it is with webpack 4 to create a lazy loaded bundle (Here). But when I t

3条回答
  •  醉话见心
    2021-01-23 00:36

    I have a trick one to lazyLoad a module with its type:

    function lazyLoad(){ return let lazyModule:typeof import('xxx') = require('xxx'); }

    limitation: the xxx can only be string not a variable.

提交回复
热议问题