Home > OS >  is it possible to import javascript libraries to browser console(devtools)?
is it possible to import javascript libraries to browser console(devtools)?

Time:11-19

im writing my own javascript library at the moment and want to permanently import it to the microsoft edge devtools console (or devtools in general), to use it there,but i dont know how to import it

thanks in advance, -Gzrespect

CodePudding user response:

  1. If you don't have a local server, get one at https://chrome.google.com/webstore/detail/web-server-for-chrome/ofhbbkphhbklhfoeikjpcbhemlocgigb/ and set up a folder to serve.

  2. set CORS in advanced server settings to allow importing it on most websites

  3. use let myModule = await import('http://127.0.0.1:8887/myModule.ts') to import it


note: that should be ES module (with imports if there are multimple files) and not CJS module (with requires)

  • Related