+ 1

Cannot use import outside a module. How to solve this error in js while using import and export but works for require why?

28th Jul 2020, 5:42 AM
Aayush $aini
Aayush $aini - avatar
2 Antworten
0
I have the same problem. My JavaScript is run in a web browser instead of through nodejs. I get the same error message in Edge. I'm trying to split up a .js file into multiple files without adding script elements to the corresponding HTML. I just want to have JavaScript define what dependencies it has without using a bundling tool.
4th Mar 2021, 12:37 AM
Josh Greig
Josh Greig - avatar