-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Labels
priority: mediumMedium Priority (not high, not low priority)Medium Priority (not high, not low priority)scope: reactIssues related to React support for NxIssues related to React support for Nxtype: bug
Description
Current Behavior
When using pnpm in an Nx React workspace, TypeScript fails to resolve the default Nx typings for CSS/SCSS modules (@nx/react/typings/cssmodule.d.ts
). Instead, it throws “Cannot find module @nx/react/typings/cssmodule.d.ts
" because pnpm’s strict symlink structure prevents Nx’s internal type declarations from being found via normal module resolution.
Expected Behavior
Manually referencing the file under node_modules
or creating a custom .d.ts
resolves the issue, but it would be ideal if Nx worked with PNPM out-of-the-box without requiring manual tweaks or local type definitions. It seems adding some relative path to tsconfig.lib.json__tmpl__
files for compilerOptions.types
can fix the issue.
GitHub Repo
No response
Steps to Reproduce
- Create a new monorepo with PNPM.
- Create a new app or lib with CSS module support.
- Import the CSS module in your app or lib.
Nx Report
Node : 18.20.3
OS : darwin-x64
Native Target : x86_64-macos
pnpm : 9.14.4
nx : 20.3.1
@nx/js : 20.3.1
@nx/jest : 20.3.1
@nx/eslint : 20.3.1
@nx/workspace : 20.3.1
@nx/devkit : 20.3.1
@nx/eslint-plugin : 20.3.1
@nx/module-federation : 20.3.1
@nx/react : 20.3.1
@nx/web : 20.3.1
@nx/webpack : 20.3.1
typescript : 5.6.3
---------------------------------------
Registered Plugins:
@nx/webpack/plugin
@nx/eslint/plugin
@nx/jest/plugin
Failure Logs
Cannot find module `./{FILE_NAME}.module.scss` or its corresponding type declarations.ts(2307)
Package Manager Version
9.14.4
Operating System
- macOS
- Linux
- Windows
- Other (Please specify)
Additional Information
No response
Metadata
Metadata
Assignees
Labels
priority: mediumMedium Priority (not high, not low priority)Medium Priority (not high, not low priority)scope: reactIssues related to React support for NxIssues related to React support for Nxtype: bug