-1

I am using the FF Dev build that supports ES6 modules. When I use

<script type="module" src="./script.js">

script.js triggers the download of other scripts in its import section at the start of the file, but that does not happen when I use:

fetch("./script.js")

I did not find how to specify the script type in the Fetch API.

1 Answers1

0

Are you doing something with the script after you fetch it? Since fetch returns a promise, as per docs, you have to do something with the resource after you get it. Fetch won't execute the code in that file, it just retrieves it.

EMC
  • 1,560
  • 2
  • 17
  • 31