Skip to content

Unresolving of absolute imports (typescript) #6286

@azinit

Description

@azinit

🐛 bug report

Preflight Checklist

  • I have read the Contributing Guidelines for this project.
  • I agree to follow the Code of Conduct that this project
    adheres to.
  • I have searched the issue tracker for an issue that matches the one I want
    to file, without success.

Description of the problem

At November 15 I had noticed, that my existing codesandbox projects had been crashed - because of unresolving of absolute imports

It's interesting that IDE autocomplete "sees" correct and actual imports by tsconfig, but at any time - build of project fails

Unfortunately, it is not reproducible locally and looks like yet one codesandbox bug :(

Error: Could not find dependency: 'pages' relative to '/src/App.tsx'

How has this issue affected you? What are you trying to accomplish?

I've tried:

  • To reproduce error on new React Typescript project (unfortunately I did)
  • To reproduce error on new Typescript project
  • To reproduce error locally
  • To reproduce on another browser (Firefox)
  • To fix error by import aliases (without success)
  • To refresh pages (many times)
  • To update tsconfig options
  • To reinstall different versions of Typescript
  • To search issue solution at codesandbox's issues (one, two)

Error: Could not find module in path: '~/pages' relative to '/src/App.tsx'

To Reproduce

  1. Create any TypeScript project
  2. Add baseUrl for absolute imports
    OR
    Add aliases for imports
  3. Get error of unresolved imports

As a simple example

Link to sandbox: link (optional)

Your Environment

Software Name/Version
Сodesandbox f89852e88
Browser Chrome 95.0.4638.69 (64 bit)
Operating System Windows 10

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