8000 [Feature Request] Resolve alias path to relative path. · Issue #31643 · microsoft/TypeScript · GitHub 6477
[go: up one dir, main page]

Skip to content
[Feature Request] Resolve alias path to relative path. #31643
@fenying

Description

@fenying

Search Terms

resolve path map

Suggestion

I think, there is two way to resolve the path:

  1. Add an option to force TS compiler transform import path in the output.
  2. Use a plugin (which described in 3.6 plan TypeScript 3.6 Iteration Plan #31639 ) to transform the path in the output.

Use Cases

I've read some rejected FEATURE REQUEST like: #10866 #9910 #5039

And there is , maybe, the official response about those request: #9910 (comment)

However that can not convince me, because of following 2 problems

  1. Like the above issues mentioned, it doesn't transform the path aliases into the real relative paths.

    This makes the output not work with Node.js because it can not find the modules by an alias path.

    Although some module like module-alias, ts-alias-loader could solve this, anyway it's not elegent, and it can not solve the second problem.

  2. If a package insides node_modules, written in TS with paths options, its alias path in *.d.ts can not be resolved. And TS compiler will throw an error because the module couldn't be resolved.

Examples

See #10866

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Out of ScopeThis idea sits outside of the TypeScript language design constraintsSuggestionAn idea for TypeScriptToo ComplexAn issue which adding support for may be too complex for the value it adds

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0