Make global function in webpack

前端 未结 1 1281
无人共我
无人共我 2021-02-07 23:36

I\'m making a typescript plugin with webpack. Everything works well but I have a problem with making it visible from outside. For example, I have files:

/* ./src         


        
相关标签:
1条回答
  • 2021-02-07 23:59

    Exporting from module does not make an entity global. You can either directly add it as a member to window:

    window.init = init;
    

    or, better still, move the init invocation to a typescript module - which in this case should be your webpack entry point.

    0 讨论(0)
提交回复
热议问题