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
Could a rule be created to require the addition of an extension when importing?
So for example this would be an error:
import'./hello/world'// Where we are actually importing `./hello/world.js`import'./hello/star'// Where we are actually importing `./hello/star.json`import'./hello/moon'// Where we are actually importing `./hello/moon/index.js`
Why? Well the import search algorithm is faster for one, not just in Node.JS, but also for Browserify, Webpack, and Haste (React Native module system). You are also guaranteed in every module system there is you will be importing the same file.
Also, if you are watching some of the conversations at nodejs/ng and nodejs/node-eps there has recently been a swell of discussion of module loading with the EPS proposing implementing ES modules in node. One point of the conversation is removing the ability for index.js to automatically be loaded, and changing other assumed aspects of loading entirely. To be completely future proof and to avoid the footguns mentioned above this rule would be very nice to have.
The text was updated successfully, but these errors were encountered:
Could a rule be created to require the addition of an extension when importing?
So for example this would be an error:
But the following would not be an error:
Why? Well the import search algorithm is faster for one, not just in Node.JS, but also for Browserify, Webpack, and Haste (React Native module system). You are also guaranteed in every module system there is you will be importing the same file.
Also, if you are watching some of the conversations at nodejs/ng and nodejs/node-eps there has recently been a swell of discussion of module loading with the EPS proposing implementing ES modules in node. One point of the conversation is removing the ability for
index.js
to automatically be loaded, and changing other assumed aspects of loading entirely. To be completely future proof and to avoid the footguns mentioned above this rule would be very nice to have.The text was updated successfully, but these errors were encountered: