[JS] ES6 Import/Export Syntax Not Working

Does repl.it support Javascript ES6's import/export syntax? For example, I'll have this line: import module from './module.js', but it'll give me a Syntax error. import { module } from './module.js' doesn't seem to work either. I've gotten this to work on other sites, so how come it doesn't work on repl.it?

You are viewing a single comment. View All
Answered by Vandesm14 [earned 5 cycles]
View Answer

@aramirez2 You have to use the HTML template first (JavaScript template won't work, it'll use Node.js require function). Secondly, put a <A> tag in the index.html file, (for example <a id="a" href="#hello">link</a>), then type console.log(a.href) into script.js file and run. Then you'll see the real url in the console.