4 ms·
https://github.com/nodejs/node-eps/blob/master/002-es6-modules.md https://github.com/nodejs/node-eps/blob/master/002-es6-modul... was merged today; v8 C++ API f
by bmeck 10y ago
https://github.com/nodejs/node-eps/blob/master/002-es6-modules.md https://github.com/nodejs/node-eps/blob/master/002-es6-modul... was merged today; v8 C++ API for node to truly support it has not been implemented yet, should be in next LTS at current pace (next year).
- spankalee 10y agoWow, a new extension for ES modules? That seems really unfortunate. Why can't node parse a file to detect if it's a module? The presence of a top-level import or export means it's a module. If it's not, then the parsed file can be kept if the file is also in strict mode. If it's sloppy, it'll have to be re-parsed. Seems like a small penalty if the goal is to enable migration. Also, why worry about ES modules importing Common JS? Just disallow that and let projects migrate to ES modules bottom-up. Then you don't have to worry about executing a Common JS module to determine what its exports are or circular dependency problems.
- bmeck 10y agoThere is a pretty epic thread that I suggest you just read the tail end of https://github.com/nodejs/node-eps/pull/3#issuecomment-214761400 https://github.com/nodejs/node-eps/pull/3#issuecomment-21476... . Basically we tried detection via source code as the first proposal; ambiguities at runtime that do not throw errors make it absolutely impossible to do safely, performance problems, and tooling integration problems.