Are there any performance benefits to using one over the other?
The current answer is no, because none of the current browser engines implements
import/export from the ES6 standard.
Some comparison charts http://kangax.github.io/compat-table/es6/ don't take this into account, so when you see almost all greens for Chrome, just be careful.
import keyword from ES6 hasn't been taken into account.
( We may be still just a few bugs away or years away until V8 implements that according to the ES6 specification. )
This document is what we need, and this document is what we must obey.
And the ES6 standard said that the module dependencies should be there before we read the module like in the programming language C, where we had (headers)
This is a good and well-tested structure, and I am sure the experts that created the ES6 standard had that in mind.
This is what enables Webpack or other package bundlers to optimize the bundle in some special cases, and reduce some dependencies from the bundle that are not needed. But in cases we have perfect dependencies this will never happen.
It will need some time until
import/export native support goes live, and the
require keyword will not go anywhere for a long time.
node.js way to load modules. ( https://github.com/nodejs/node )
Node uses system-level methods to read files. You basically rely on that when using
require will end in some system call like
To check that this is true, try to use Babel.js, and you will see that the
import keyword will be converted into