Skip to content

Suggestion: Transpile path mappings based module resolution imports to relative paths #6710

Closed
@dsherret

Description

@dsherret

Taking example 2 from the original issue (#5039):

projectRoot
├── folder1
│   ├── file1.ts
│   └── file2.ts
├── generated
│   ├── folder1
│   └── folder2
│       └── file3.ts (Contains: import 'folder1/file2';)
└── tsconfig.json (with "baseUrl": ".")

When doing...

import 'folder1/file2';

...in file3.ts it current compiles to the same thing as above. Would it be possible if we could add a compiler option or some way that would convert this to the relative path? So it would transpile it to:

import './../../folder1/file2';

That way the paths don't have to be managed in two places. I couldn't find this discussed anywhere and didn't want to clutter the original issue so I'm opening this here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs More InfoThe issue still hasn't been fully clarified

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions