Home  >  Q&A  >  body text

javascript - There is a js library that I want to use, but npm does not provide it. The original method was to download the file script reference. Now I want to use import to reference it but it is wrong. Please give me some advice.

Looking at the code of that library, it should be an IIFE, and then the variables are exposed to the window. There is no export, so I can't import it. How can I import this file? I don't want to use script references in html.

滿天的星座滿天的星座2709 days ago924

reply all(3)I'll reply

  • 大家讲道理

    大家讲道理2017-06-12 09:31:25

    I’m afraid I have to change it myself, open IIFE, and directly export the attributes originally added to windows...

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-06-12 09:31:25

    import ** from *** (path)

    reply
    0
  • 为情所困

    为情所困2017-06-12 09:31:25

    如果没有export引js如下
    import "./assest/js/autoPageFont.js";
    就这样引js,这样就会执行你这样引的js
    

    reply
    0
  • Cancelreply