babel-plugin-module-resolver
babel-plugin-module-resolver copied to clipboard
How to not remove trailing '/index' ?
Is there any options that can control whether to remove trailing '/index' in path ?
import a from 'packages/a/index'
I believe we do remove index
? Because it's the default behavior.
What situation makes you willing to have an option to decide this?
I found this feature when run code in node environment using node esm.
I believe that node doesn't take this as a default behavior. In the API document (#esm_differences_between_es_modules_and_commonjs):
A file extension must be provided when using the
import
keyword. Directory indexes (e.g. './startup/index.js') must also be fully specified.This behavior matches how
import
behaves in browser environments, assuming a typically configured server.
Interesting, so it's a bit specific to esm I believe. Wonder if we could revert our decision to strip the extension and index name. @fatfisz what do you think?