Skip to content

Project module name import conflict with node_modules #9

@afrankel-sfdo

Description

@afrankel-sfdo

Describe the bug

  • Using absolute imports to a project path that also exists in node_modules breaks

Did you try recovering your dependencies?

Yes

Environment

Environment Info:

  current version of create-react-app: 3.3.1
  running from /Users/afrankel/.config/yarn/global/node_modules/create-react-app

  System:
    OS: macOS 10.15.5
    CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
  Binaries:
    Node: 10.16.3 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.9.0 - /usr/local/bin/npm
  Browsers:
    Chrome: 83.0.4103.116
    Firefox: Not Found
    Safari: 13.1.1
  npmPackages:
    react: ^16.13.1 => 16.13.1 
    react-dom: ^16.13.1 => 16.13.1 
    react-scripts: Not Found
  npmGlobalPackages:
    create-react-app: Not Found

Expected behavior

  • graphql/string should import fine

Actual behavior

  • Error: Cannot find module 'graphql/string'

Screen Shot 2020-07-14 at 9 04 11 AM

Reproducible demo

git clone https://github.com/afrankel-sfdo/cra-ssr-test.git cura-import-bug; cd cura-import-bug; git reset --hard e97f641adb96f4525a577d4ea58f142d0c92ecd6; yarn; yarn start

Temporary fix

Workaround by renaming project folder. Also works fine in vanilla CRA.

git clone https://github.com/afrankel-sfdo/cra-ssr-test.git cura-import-fix; cd cura-import-fix; git reset --hard 1b7cace04e103e184bcef070a153499568703679; yarn; yarn start

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions