I have two files in the same folder , one called main.js
and the other es.js
.
The problem is that when trying to import a class of es.js
, from main.js
throws me the error:
Uncaught SyntaxError: Unexpected token import
main.js:
import ES from './es.js';
en.js
class ES{
constructor(){
get(symbol, e){
let d = document;
return symbol === "#" ? d.getElementById(e) : symbol === "." ? d.getElementsByClassName(e) : d.getElementsByTagName(e);
}
}
}
export default ES;