Skip to content

Instantly share code, notes, and snippets.

  • Save kenmori/1474bbd22240bcf4a9c750e67f43a898 to your computer and use it in GitHub Desktop.
Save kenmori/1474bbd22240bcf4a9c750e67f43a898 to your computer and use it in GitHub Desktop.
rewiredしたCRAでTypeScirptのパス解決を相対パスから絶対パスに変更した際のnode_modulesまでbaseUrlになる場合の解決「Your project's `baseUrl` can only be set to `src` or `node_modules`. Create React App does not support other values at this time.」

rewiredしたCRAでTypeScirptのパス解決を相対パスから絶対パスに変更した際のnode_modulesまでbaseUrlになる場合の解決

Your project's baseUrl can only be set to src or node_modules. Create React App does not support other values at this time.

To Fix

  • Add src/.env
  • Add src/path.json
  • Fix tsconfig.json

Add src/.env

NODE_PATH=./

Add src/path.json

{
  "compilerOptions": {
    "baseUrl": "."
  }
}

Fix tsconfig.json

 "extends": "./path.json",

kenjimorita

facebook/create-react-app#6850

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment