ts-loader icon indicating copy to clipboard operation
ts-loader copied to clipboard

bug: fail with yarn 3 + pnp + workspaces + typescript references

Open DiFuks opened this issue 3 years ago • 2 comments

Expected Behaviour

ts-loader works with yarn 3 + pnp + workspaces + typescript references

Actual Behaviour

Link: https://github.com/TypeStrong/ts-loader/issues/1145#issuecomment-1067891664

Fail: image

Location of a Minimal Repository that Demonstrates the Issue.

https://github.com/DiFuks/ts-references

yarn tsc - working yarn ts-node - working yarn webpack:babel-loader - working yarn webpack:ts-loader - not working :(

Module not found: Error: Can't resolve './showLib' in '/Users/difuks/PhpstormProjects/ts-references/entries/submodule/dist'

At the same time, with such an edit, everything starts to work. But in this case main uses the uncompiled version of submodule

Information about various build variations is stored here: https://github.com/DiFuks/ts-references/blob/master/entries/main/src/showLib.ts#L7

This workaround also works fine

With nodeLinker: node-modules in .yarnrc.yml things get a little better, but relative imports still don't work (../../submodule)

With symlinks: true the situation returns to the one that was in the "master" branch

DiFuks avatar Mar 15 '22 17:03 DiFuks

If you'd like to look into this I'll happily take a look at a pull request.

johnnyreilly avatar Mar 15 '22 19:03 johnnyreilly

I removed js processing from ts-loader and everything worked as expected. As I understand it, this is the expected behavior: https://github.com/TypeStrong/ts-loader/issues/465

DiFuks avatar Mar 15 '22 20:03 DiFuks