4 ms·
There's an `import` statement with its custom syntax, which yes, does not allow anything else than a static string literal on the `from` part. But there's also
by epidemian 6y ago
There's an `import` statement with its custom syntax, which yes, does not allow anything else than a static string literal on the `from` part. But there's also an import() function, which is, well, just a function, so you can pass to it whatever parameter you want. For example a string computed dynamically as in your example. The linked page in my comment has a couple of examples of that function.