TypeScript: Typescript build not working as expected with symlinks.
TypeScript Version: 2.0.0-dev.20160630
Code
When I use a symlink in Windows I’m getting different build results. I haven’t tested this with Mac/Linux yet.
dev
app
node_modules
test
foo.ts
index.ts
Builds to:
dev
app
bld
node_modules
test
foo.js
index.js
...
Using symlink
mklink /D "c:\dev\app\node_modules\test\" "c:\dev\test\"
dev
test
foo.ts
app
node_modules
test => /dev/test
index.ts
Builds to:
dev
app
bld
app
index.js
test
foo.js
...
Expected behavior:
Building with and without a symlink should build the same.
Actual behavior:
Building without a symlink behaves normally. Building with a symlink does not treat the directory as a link but uses the actual location of the linked directory. This causes problems with module resolution.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 11
- Comments: 15 (1 by maintainers)
I am experiencing the same issue. Looking forward to a fix.
I am using typescript 2.0.6 and having the same issues with symbolic links.
I have put together a simple example that demonstrates the problem
https://github.com/jmc420/typescript_examples/tree/master/symlink_problem
The README explains the issue. The question is whether it is possible to get the compiler to generate the same output regardless of whether a typescript file is a symbolic link or not.
That may be because of the TypeScript version used by IntelliJ / angular-cli. This fix is in
typescript@next
and will be added to the next 2.1 release, so it should work whenever your tools are updated to use that.Fixed by #12020