Reputation: 13
While importing Axios I am facing an error
Uncaught SyntaxError: Cannot use import statement outside a module
I am importing Axios like this:
import axios from 'axios'
this is how i import axios in main js file that is shown above
this is my project header ,where i have included my js file
Upvotes: 0
Views: 1495
Reputation: 21
Where are you using this statement? If you are you using it on backend then you should use
const axios = require('axios');
if you are getting it on frontend then you may not have installed the package axios. To install it run
npm i axios
Upvotes: 1