I have a simple project like this and have already install axios: The project
In main.js,I tried to import the axios and a json file but throw error:
import axios from 'axios' //SyntaxError: Cannot use import statement outside a module import Test_data from 'json/test.json' //SyntaxError: Cannot use import statement outside a module If I use require() it will success,could anybody tell me why?
var axios=require('axios');//success var Test_data=require('./json/test.json');//success console.log(Test_data);//success