babel-plugin-module-resolver
babel-plugin-module-resolver copied to clipboard
Referencing file with same name as parent directory resolves to an erroneous path
Hi.
Whenever I import a file in a React / Typescript project with the same name as its parent directory - excluding the extension, as is convention - the resolver converts to the following glob pattern: **/*. Hence the below returns the following (sic): cannot access module at ./app/components/**/*/Button. There seems to be some kind of pattern matching that turns 2 consecutive Paths into a glob. As if I append the extension, it works fine. Is this expected?
Here's my config:
[
'module-resolver',
{
extensions: ['.ts', '.tsx'],
alias: {
components: './app/components',
},
},
],
Here's the import statement:
import Button from 'components/Button/Button'
And the folder structure is:
app
-components
--Button
---Button.tsx