I'm trying to import the axios module to the background script of a chrome extension and I'm getting the following error:
Uncaught SyntaxError: The requested module './node_modules/axios/lib/axios.js' does not provide an export named 'default'
Since chrome extensions need to use the script tag to use external modules, I'm doing it the following way:
manifest.json
"background": {
"page": "background.html",
"persistent": false
},
...
background.html
<script type="module" src="./background.js"></script>
background.js
import axios from './node_modules/axios/lib/axios.js';
...
I also tried to use the named import with the code below but got a similar message (the 'default' was switched with 'axios')
import { axios } from './node_modules/axios/lib/axios.js';