Skip to content

Doesn't rename references to index.js files when imported by directory #71

@spudly

Description

@spudly

When you import a file by directory that contains an index.js file, and you rename the index.js file, references to it don't get updated.

Take the following example. Here's what the directory structure looks like before the refactor:

src/
  components/
    MyComponent.js (this file imports from "./propTypes")
    propTypes/
      index.js

If you rename /components/propTypes/index.js to /utils/propTypes.js, it will not update the MyComponent.js file to import from the new location.

Directory Structure after refactor:

src/
  components/
    MyComponent.js (this file imports from "./propTypes")
  utils/
    propTypes.js

Import String before refactor:

import * as propTypes from './propTypes';

Expected import string after refactor:

import * as propTypes from '../utils/propTypes';

Actual import string after refactor: (same as before refactor)

import * as propTypes from './propTypes';

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions