question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Typings problems in rush monorepo (pnpm hard links)

See original GitHub issue

Current Behavior

tsdx build fails inside rush monorepo, when importing third party types and modules

(typescript) Error: /Users/sinled/dev/Projects/_my/_tmp/test-rushx-tsdx/packages/somelib/src/index.tsx(7,10): semantic error TS2305: Module '"../node_modules/office-ui-fabric-react/lib/Styling"' has no exported member 'mergeStyleSets'.
Error: /Users/sinled/dev/Projects/_my/_tmp/test-rushx-tsdx/packages/somelib/src/index.tsx(7,10): semantic error TS2305: Module '"../node_modules/office-ui-fabric-react/lib/Styling"' has no exported member 'mergeStyleSets'.
    at error (/Users/sinled/dev/Projects/_my/_tmp/test-rushx-tsdx/common/temp/node_modules/.pnpm/registry.npmjs.org/rollup/1.32.1/node_modules/rollup/dist/shared/node-entry.js:5400:30)
    at throwPluginError (/Users/sinled/dev/Projects/_my/_tmp/test-rushx-tsdx/common/temp/node_modules/.pnpm/registry.npmjs.org/rollup/1.32.1/node_modules/rollup/dist/shared/node-entry.js:11878:12)
    at Object.error (/Users/sinled/dev/Projects/_my/_tmp/test-rushx-tsdx/common/temp/node_modules/.pnpm/registry.npmjs.org/rollup/1.32.1/node_modules/rollup/dist/shared/node-entry.js:12912:24)
    at Object.error (/Users/sinled/dev/Projects/_my/_tmp/test-rushx-tsdx/common/temp/node_modules/.pnpm/registry.npmjs.org/rollup/1.32.1/node_modules/rollup/dist/shared/node-entry.js:12081:38)
    at RollupContext.error (/Users/sinled/dev/Projects/_my/_tmp/test-rushx-tsdx/common/temp/node_modules/.pnpm/registry.npmjs.org/rollup-plugin-typescript2/0.27.3_rollup@1.32.1+typescript@3.9.7/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:17237:30)
    at /Users/sinled/dev/Projects/_my/_tmp/test-rushx-tsdx/common/temp/node_modules/.pnpm/registry.npmjs.org/rollup-plugin-typescript2/0.27.3_rollup@1.32.1+typescript@3.9.7/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:25033:23
    at arrayEach (/Users/sinled/dev/Projects/_my/_tmp/test-rushx-tsdx/common/temp/node_modules/.pnpm/registry.npmjs.org/rollup-plugin-typescript2/0.27.3_rollup@1.32.1+typescript@3.9.7/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:545:11)
    at Function.forEach (/Users/sinled/dev/Projects/_my/_tmp/test-rushx-tsdx/common/temp/node_modules/.pnpm/registry.npmjs.org/rollup-plugin-typescript2/0.27.3_rollup@1.32.1+typescript@3.9.7/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:9397:14)
    at printDiagnostics (/Users/sinled/dev/Projects/_my/_tmp/test-rushx-tsdx/common/temp/node_modules/.pnpm/registry.npmjs.org/rollup-plugin-typescript2/0.27.3_rollup@1.32.1+typescript@3.9.7/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:25006:12)
    at Object.transform (/Users/sinled/dev/Projects/_my/_tmp/test-rushx-tsdx/common/temp/node_modules/.pnpm/registry.npmjs.org/rollup-plugin-typescript2/0.27.3_rollup@1.32.1+typescript@3.9.7/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:29277:17)

Expected behavior

build success

Suggested solution(s)

i don’t know

Additional context

here is reproduction repo https://github.com/Sinled/test-rushx-tsdx (but it needs rush)

git clone https://github.com/Sinled/test-rushx-tsdx
rush update
rush build

i am not sure if this is tsdx or rush problem, on the one hand, if i use tsc - instead of tsdx - it builds fine

cd packages/somelib
./node_modules/.bin/tsc --noEmit false 

but on the other - if i install dependencies directly inside package - tsdx also builds ok

Your environment

  System:
    OS: macOS 10.15.7
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 459.79 MB / 32.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 14.15.0 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.8 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Browsers:
    Chrome: 87.0.4280.141
    Firefox: 81.0.1
    Safari: 14.0.1

Any ideas how this can be solved?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:5
  • Comments:7

github_iconTop GitHub Comments

2reactions
agilgur5commented, Jun 10, 2022

For reference, I am fairly sure I fixed this upstream in https://github.com/ezolenko/rollup-plugin-typescript2/pull/332, which fixed https://github.com/ezolenko/rollup-plugin-typescript2/issues/234, which is a very similar upstream issue with pnpm symlinks.

To use that in your project, you can set your pnpm overrides to use rollup-plugin-typescript2 0.32.0+:

{
  "pnpm": {
    "overrides": {
      "rollup-plugin-typescript2": "^0.32.0"
    }
  }
}
1reaction
Sinledcommented, Jan 14, 2021

If anyone stumbled upon this, i’ve found partial workaround - typecheck with tsc and build with tsdx

"build": "tsc && tsdx build --transpileOnly"
Read more comments on GitHub >

github_iconTop Results From Across the Web

Typings problems in rush monorepo (pnpm hard links) #953
Current Behavior tsdx build fails inside rush monorepo, when importing third party types and modules (typescript) Error: ...
Read more >
used by pnpm & @microsoft/rush monorepos : WEB-47427
We're switching the monorepo at our company to pnpm in the coming week. Due to our large repo and deeply nested repositories, it's...
Read more >
rushstack/rushstack - Gitter
Hello! Rush question here - is there an equivalent to 'yarn link' to add dependencies to local packages? @j-v The local packages get...
Read more >
rush.json
rush install, rush update, rush link, rush version, rush publish ... Large monorepos can become intimidating for newcomers if project folder paths don't ......
Read more >
Highest scored 'pnpm' questions - Stack Overflow
pnpm uses hard links and symlinks to save one version of a module only ever ... my team is migrating to rush and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found