Answer the question
In order to leave comments, you need to log in
How to properly import a JS file from the static folder?
When importing, the script gives an error that this module is not a constructor.
I'm trying to import a twitch embed api file.
If you insert the script tag into index.html, then everything is ok.
Answer the question
In order to leave comments, you need to log in
const script = document.createElement('script');
script.async = true;
script.src = '/static/your-script.js';
document.head.appendChild(script);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question