Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to not remove trailing '/index' ? #411

Open
ExcitedSpider opened this issue Oct 12, 2020 · 3 comments
Open

How to not remove trailing '/index' ? #411

ExcitedSpider opened this issue Oct 12, 2020 · 3 comments

Comments

@ExcitedSpider
Copy link

Is there any options that can control whether to remove trailing '/index' in path ?

import a from 'packages/a/index'

@tleunen
Copy link
Owner

tleunen commented Oct 19, 2020

I believe we do remove index? Because it's the default behavior.

What situation makes you willing to have an option to decide this?

@ExcitedSpider
Copy link
Author

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.

@tleunen
Copy link
Owner

tleunen commented Oct 21, 2020

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants