简体   繁体   中英

How to make webpack require work like script tag

So I have some JS libs I want to use at global scope ( window ). They are built with webpack I assume, where their dist code has something like module.exports=xxx If I put them as <script></script> tag in html, I can access them there. But If I require them in webpack, then bundle them with webpack, I cannot see them in global scope.

Is there anything I can do to make them visible without modifying the library itself?

您可以尝试使用脚本加载器 ,这非常简单。代码将在全局范围内执行。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM