-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Description
Search Terms
resolve path map
Suggestion
I think, there is two way to resolve the path:
- Add an option to force TS compiler transform import path in the output.
- 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
-
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. -
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.