Is it possible to import javascript module from external url in ES6?
I tried (using babel-node):
import mymodule from 'http://...mysite.../myscript.js'; // Error: Cannot find module 'http://...mysite.../myscript.js'
2018 Update: The module loader spec is now a part of the ES Spec - what you are describing is allowed and possible with <script type="module">
in browsers and with a custom --loader
with Node.js as well as with Deno if you're into that.
The module loader spec and the import/export syntax are separate. So this is a property of the module loader (not a part of the ES spec). If you use a module loader that supports plugins like SystemJS.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With