search

Home  >  Q&A  >  body text

How to use script tags to introduce the opensea-js library in pure HTML/JS?

<p>I want to use opensea-js in my html/js project, but their source code is only published on github and npm. https://github.com/ProjectOpenSea/opensea-js</p> <p>How can I use this in normal html? (Not a page based on node.js)</p> <p>I found something here</p><p> https://www.jsdelivr.com/package/npm/opensea-js</p> <p>But after I put this code into my html it doesn't work. </p> <pre class="brush:php;toolbar:false;"><script src="https://cdn.jsdelivr.net/npm/@bthn/opensea-js@4.0.1/lib/index .min.js"></script></pre></p>
P粉491421413P粉491421413449 days ago515

reply all(1)I'll reply

  • P粉311423594

    P粉3114235942023-09-03 15:11:37

    I strongly recommend using babel or webpack. No matter which one you choose, there's a steep learning curve, so you should start using one while you're at it rather than developing bad habits later.

    Using babel/webpack has many advantages over using CDN. Refer to this article (it also works with babel): https://webpack.js.org/concepts/why-webpack/

    reply
    0
  • Cancelreply