Add support for ES6 import syntax
See original GitHub issueThis might be a long shot but I’d like to see this in browserify.
The ES6 module syntax has a few nice features compared to commonJS require
method,
namely bindings and cyclic dependencies.
Since these things are in the ES6 standard it seems reasonable to work them into browserify too!
Note that just using a ES6 to ES5 transpiler wouldn’t work in this case because these are cross module concerns.
For instance, babelify
is only able to transpile import foo from 'foo'
to var foo = require('foo')
at file-level, but this does not allow cyclic dependencies.
The Esperanto project has a nice way of handling things but lacks too many features to be a valid replacement for browserify.
Is there any possibility to see support for ES6 import
syntax come to browserify?
Issue Analytics
- State:
- Created 8 years ago
- Reactions:57
- Comments:59 (22 by maintainers)
Top GitHub Comments
For the mean time, I’ve created a browserify plugin that:
.mjs
extension to browserify so that it takes precedence over.js
"module"
field in package.json (when"browser"
is not specified)See here: https://github.com/mattdesl/esmify
I’ve been waiting for this feature to land in node first so browserify can match the semantics properly. I’m also concerned that if browserify implements a default es6 import mechanism while node doesn’t have one, it will needlessly fragment browser and server ecosystems.