I'm trying out JavaScript modules by enabling the "Experimental Web Platform" flag in Chrome Dev (v60, at time of writing).
When I try to import this module:
export default let foo = 10;
I get this error message:
Uncaught SyntaxError: Unexpected strict mode reserved word
It works fine without the default
keyword. And this works fine too:
let a = 10;
export default a;
MDN doesn't explicitly say that the export default ...
notation is allowed with let
, var
, const
, etc. but they do give examples with functions like this:
export default function (…) { … }.
And variables like this:
export let name1 = …, name2 = …, …, nameN;
Question: Is it not possible with the current specification to export regular variables with the default
keyword as can be done with functions and classes?