You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I should point out that resolution will, in general, be faster and more robust if you always reference path/to/index, even if you can refer to it by folder in the node resolution algorithm. Folder imports cause the resolver to look for a package.json to try to ascertain the main file.
However our aim is to provide a great developer experience, so it seems a bit awkward to ask users to write this:
import{X}from'./folder1/folder2/index';
...instead of this:
import{X}from'./folder1/folder2';
Microoptimizations are the job of the tooling, not something humans should have to worry about. Let's discuss:
How significant are these extra filesystem accesses, really?
If they matter, what are the options for eliminating them?
Implement an ESLint rule that asks for path imports to be written as "./folder1/folder2/" with a trailing slash. This isn't as awkward as "./folder1/folder2/index", and maybe still provides most of the benefits.
Implement a compiler transform that automatically normalizes paths to "./folder1/folder2/index" in the emitted .js files. This would be completely transparent to users, the best developer experience. It would also enables
Simply use Webpack to bundle our Node.js projects. This has been suggested many times before and would probably be a huge performance improvements. The classic concern was with bundling node_modules dependencies, which often are incompatible with bundling. Plus there's a license attribution concern when embedding another project's code. But if we entirely externalized the node_modules dependencies, Webpack could still provide some benefits.
(Before proceeding though, someone would need to collect some performance measurements showing that this investment would actually be worthwhile.)
In #2254 (comment), @dmichon-msft pointed out that:
However our aim is to provide a great developer experience, so it seems a bit awkward to ask users to write this:
...instead of this:
Microoptimizations are the job of the tooling, not something humans should have to worry about. Let's discuss:
CC @iclanton @sachinjoseph
The text was updated successfully, but these errors were encountered: