0

I need use axios inside a webworker defined in js file.

This is a Hello World CLI project in vue3, with only axios installed (npm install axios)

enter image description here

enter image description here

The output: enter image description here

This work fine, but when i uncomment import axios from "axios" in webworker.js I get the following error in the console:

webworker.js:1 Uncaught SyntaxError: Cannot use import statement outside a module

How can i use axios inside a webworker?

Musculaa
  • 934
  • 10
  • 19
  • Answered here: https://stackoverflow.com/questions/48931878/how-to-import-a-library-like-moment-js-into-a-web-worker – Michael Mano Sep 02 '21 at 22:40
  • Does this answer your question? [How to import a library like moment.js into a web worker](https://stackoverflow.com/questions/48931878/how-to-import-a-library-like-moment-js-into-a-web-worker) – Michael Mano Sep 02 '21 at 22:41
  • Michael Mano, I did not find solutions in that link. I looked everywhere and I can't find the answer – Musculaa Sep 07 '21 at 13:31

0 Answers0