Closed rosskevin closed 6 years ago
found some info in traceResolution, working through it now:
~/p/lerna-yarn-workspaces-example ❯❯❯ yarn tsc --traceResolution
yarn run v1.5.1
$ /Users/kross/projects/lerna-yarn-workspaces-example/node_modules/.bin/tsc --traceResolution
======== Resolving module '@quramy/x-core/foo' from '/Users/kross/projects/lerna-yarn-workspaces-example/packages/x-cli/src/main.ts'. ========
Module resolution kind is not specified, using 'NodeJs'.
'baseUrl' option is set to '/Users/kross/projects/lerna-yarn-workspaces-example/packages', using this value to resolve non-relative module name '@quramy/x-core/foo'.
'paths' option is specified, looking for a pattern to match module name '@quramy/x-core/foo'.
Module name '@quramy/x-core/foo', matched pattern '@quramy/*'.
Trying substitution './*/src', candidate module location: './x-core/foo/src'.
Loading module as file / folder, candidate module location '/Users/kross/projects/lerna-yarn-workspaces-example/packages/x-core/foo/src', target file type 'TypeScript'.
Loading module '@quramy/x-core/foo' from 'node_modules' folder, target file type 'TypeScript'.
Directory '/Users/kross/projects/lerna-yarn-workspaces-example/packages/x-cli/src/node_modules' does not exist, skipping all lookups in it.
Scoped package detected, looking in 'quramy__x-core/foo'
Directory '/Users/kross/projects/lerna-yarn-workspaces-example/packages/x-cli/node_modules/@types' does not exist, skipping all lookups in it.
Scoped package detected, looking in 'quramy__x-core/foo'
Directory '/Users/kross/projects/lerna-yarn-workspaces-example/packages/node_modules' does not exist, skipping all lookups in it.
Scoped package detected, looking in 'quramy__x-core/foo'
Found 'package.json' at '/Users/kross/projects/lerna-yarn-workspaces-example/node_modules/@quramy/x-core/package.json'.
File '/Users/kross/projects/lerna-yarn-workspaces-example/node_modules/@quramy/x-core/foo.ts' does not exist.
File '/Users/kross/projects/lerna-yarn-workspaces-example/node_modules/@quramy/x-core/foo.tsx' does not exist.
File '/Users/kross/projects/lerna-yarn-workspaces-example/node_modules/@quramy/x-core/foo.d.ts' does not exist.
Scoped package detected, looking in 'quramy__x-core/foo'
Directory '/Users/kross/projects/node_modules' does not exist, skipping all lookups in it.
Scoped package detected, looking in 'quramy__x-core/foo'
Directory '/Users/kross/node_modules/@types' does not exist, skipping all lookups in it.
Scoped package detected, looking in 'quramy__x-core/foo'
Directory '/Users/node_modules' does not exist, skipping all lookups in it.
Scoped package detected, looking in 'quramy__x-core/foo'
Directory '/node_modules' does not exist, skipping all lookups in it.
Scoped package detected, looking in 'quramy__x-core/foo'
'baseUrl' option is set to '/Users/kross/projects/lerna-yarn-workspaces-example/packages', using this value to resolve non-relative module name '@quramy/x-core/foo'.
'paths' option is specified, looking for a pattern to match module name '@quramy/x-core/foo'.
Module name '@quramy/x-core/foo', matched pattern '@quramy/*'.
Trying substitution './*/src', candidate module location: './x-core/foo/src'.
Loading module as file / folder, candidate module location '/Users/kross/projects/lerna-yarn-workspaces-example/packages/x-core/foo/src', target file type 'JavaScript'.
Loading module '@quramy/x-core/foo' from 'node_modules' folder, target file type 'JavaScript'.
Directory '/Users/kross/projects/lerna-yarn-workspaces-example/packages/x-cli/src/node_modules' does not exist, skipping all lookups in it.
Directory '/Users/kross/projects/lerna-yarn-workspaces-example/packages/node_modules' does not exist, skipping all lookups in it.
Found 'package.json' at '/Users/kross/projects/lerna-yarn-workspaces-example/node_modules/@quramy/x-core/package.json'.
File '/Users/kross/projects/lerna-yarn-workspaces-example/node_modules/@quramy/x-core/foo.js' does not exist.
File '/Users/kross/projects/lerna-yarn-workspaces-example/node_modules/@quramy/x-core/foo.jsx' does not exist.
Directory '/Users/kross/projects/node_modules' does not exist, skipping all lookups in it.
Directory '/Users/node_modules' does not exist, skipping all lookups in it.
Directory '/node_modules' does not exist, skipping all lookups in it.
======== Module name '@quramy/x-core/foo' was not resolved. ========
Figured it out and pushed change to PR for anyone that finds this. To support this and the index use case, you need to manually list each package path in addition to the general wildcard:
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"baseUrl": "./packages",
"paths": {
"@quramy/x-core/*": ["./x-core/src/*"],
"@quramy/*": ["./*/src"]
}
}
}
Anyone knows how to link local dependencies in development?
when I execute node packages/x-cli/lib/main.js,
I got Error: Cannot find module '@quramy/x-core/foo/bar'
Hey, thanks for sharing this!
I'm transitioning some internal repos and having some problems with imports, namely
PR with changes/demo: https://github.com/Quramy/lerna-yarn-workspaces-example/pull/5/files
What am I missing here? It's got to be simple but I have yet to spot it.
Any thoughts?