title: Why is import axios for web worker not working?
body: <p>I am attempting to create an API request with web worker using axios, here is my worker.js</p>
  
  <pre><code>import axios from 'axios'
  export default () =&gt; {
      self.addEventListener('message', e =&gt; {
          if (!e) return;
          let config = e.data;
          let url = config.url;
          let params = config.params;
          setInterval(()=&gt;{
              axios.get(url,{params}).then(res=&gt;{
                  postMessage(res);
              })
          },5000);
      });
  }
  </code></pre>
  
  <p>The only thing that being weird is axios is not defined, what am i doing wrong?</p>
  
  <p>here the snippet of my webworker codes</p>
  
  <pre><code>export default class MonitoringWorker {
      constructor(worker) {
          const code = worker.toString();
          const blob = new Blob(['(' + code + ')()']);
          return new Worker(URL.createObjectURL(blob));
      }
  }
  
  import worker from './worker/worker'
  import MonitoringWorker from './worker/MonitoringWorker'
  
      export default class TransactionMonitoring extends Component{
          componentDidMount(){
              console.log({worker})
              this.worker = new MonitoringWorker(worker);
              this.worker.addEventListener('message', e =&gt; {
                  console.log("RECEIVED DATA",e.data);
              });
              this.worker.postMessage({ url:'xxxx'})
          }
         //restOfcode
      }
  </code></pre>