0

how do i import a module in javascript

am trying to import a module in javascript but getting an error #'Uncaught SyntaxError: Unexpected token import'

4th Nov 2021, 8:41 PM
John Delvin
John Delvin - avatar
2 odpowiedzi
+ 1
Here is more about import https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import It will be good if you post example of your code here, and module what you importing, so we can see what is problem. Syntax error mostly means some typo or some wrong syntax
4th Nov 2021, 9:56 PM
PanicS
PanicS - avatar
+ 1
Import is a keyword for ES6, if you don’t have a transpiler to CommonJS use require(‘your module’)
5th Nov 2021, 8:08 AM
Guillem Padilla
Guillem Padilla - avatar