Skip to content

eject removes linked react-scripts copy instead of symlink #1732

Closed
@tuchk4

Description

@tuchk4

Starts here #1356 (comment)

ownPath - path to react-scripts root.

If react-scripts is linked - app node_modules looks like this

App/
  |- node_modules/
                 |- react-scripts/ -> (symlink)/lib/node_modules/react-scripts
Case ownPath Notes
resolveApp('node_modules/react-scripts') APP/node_modules/react-scripts Path to react-scripts symlink
resolveOwn('.') CRA_DIR/packages/react-scripts Path to local react-scripts copy
resolveOwn('react-scripts') LOCAL_CRA/packages/react-scripts/react-scripts Path is wrong

1st and 2nd cases are the same expect eject - we remove (eject.js:160) react-scripts from node_modules after eject.
In 2nd case local CRA packages/react-scripts will be removed instead of app node_modules/react-scripts.

@Timer We opted to switch to resolveOwn('.') because we don't want to hardcode the package name to be react-scripts.


I had unpleasant situation when run eject at app with linked react-scripts and my local CRA packages/react-scripts were removed with uncommitted changes :(

I have another implementation without name hardcode. I will test it and make new PR

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions