First off, I am still quite a beginner in Javascript, and the solution is most likely very obvious, but I just can't get it to work. I am trying to import this GitHub project: https://github.com/ProjectOpenSea/opensea-js. Installing it with npm and importing it in a script works fine using the following code:
import { OpenSeaPort, Network } from 'opensea-js'
However, how would I import and use these functions in a web based application?
The library itself cannot be imported into a web application to be run on the client side (aka run in the browser of the person visiting the site).
To interface with the library, you'd want to use something like Express.js. With Express, you could make a web server that acts like an API. A web application would request data from the API, the API/server runs the OpenSea library to do whatever you want, and then you send back whatever you want that OpenSea did back to the user.
However, you could also use OpenSea's own api, documented here