0👍
✅
import
is a statement.
https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Statements/import
so while this works:
var import_ = function(x){ return x; };
var x = (a) => () => import_(a + 1);
x(3)()
/*
4
*/
this fails syntactically (tested in FF scratchpad (Shift-F4))
var x = (a) => () => import("");
x(3)()
/*
Exception: SyntaxError: expected expression, got keyword 'import'
@Scratchpad/1:2
*/
while on node you get a different error message, but essentially the same
$ node
> var x = (a) => () => import("");
var x = (a) => () => import("");
^^^^^^
SyntaxError: Unexpected token import
Source:stackexchange.com