Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Merge requests
  • !10014

Use "paths" in tsconfig.json and jsconfig.json

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Administrator requested to merge github/fork/sheepsteak/paths into main Nov 04, 2020
  • Overview 29
  • Commits 8
  • Pipelines 1
  • Changes 4

Created by: sheepsteak

Adds support for compilerOptions.paths in both tsconfig.json and jsconfig.json so that path mapping can be used:

"compilerOptions": {
  "baseUrl": "src",
  "paths": {
    "base/*": ["./components/base/*"],
    "pages/*": ["./components/pages/*"],
    "actions/*": ["./state/actions/*"]
  }
}
  • Parse paths and add to Jest aliases
  • Parse paths and add to Webpack aliases
  • Show error when paths is used without baseUrl for TypeScript before 4.1
  • Show error when paths is used improperly (has to be like example above with only one possible location; no extra fallbacks as Webpack 4 can't handle it)
  • Add docs

I've tried different combinations of paths in both JavaScript and TypeScript projects but no doubt there are still some bugs. I'd just like to get some early feedback and find out what the appropriate level of testing is.

Closes #5645 Closes #9406 Closes #9999 (closed)

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/sheepsteak/paths