Package Exports Resolution Issue with CSS Imports
Description
Cursor IDE doesn't properly resolve package exports for CSS imports, particularly when working with locally linked packages. When trying to import a CSS file using the package's defined exports path, the IDE suggests creating a new file instead of resolving to the correct location.
Steps to Reproduce
-
Create two projects in the same parent directory:
workspace/ ├── my-project/ # Main project └── my-ui-lib/ # Local package -
Set up the local package
my-ui-libwith the following structure:my-ui-lib/ ├── package.json ├── dist/ │ └── styles/ │ └── theme.css -
In
my-ui-lib/package.json, define exports:{ "name": "my-ui-lib", "exports": { "./styles/*": "./dist/styles/*.css" } } -
In your main project's (
my-project/package.json):{ "dependencies": { "my-ui-lib": "file:../my-ui-lib" } } -
Create a CSS file in your main project:
@import "my-ui-lib/styles/theme.css"; -
Try to command-click (or ctrl-click) the import path
Current Behavior
The IDE suggests creating a new file at my-ui-lib/styles/theme.css instead of resolving to the actual file location at my-ui-lib/dist/styles/theme.css.
Expected Behavior
The IDE should resolve the import to my-ui-lib/dist/styles/theme.css based on the package exports mapping in the package.json.
Environment
- OS: darwin 24.4.0
- Cursor Version: 0.49.4
Additional Context
- Both projects must be in the same parent directory for the local package linking to work
- The file exists at the correct location (
node_modules/my-ui-lib/dist/styles/theme.css) - The package exports mapping is correctly defined in the
package.json - This appears to be specific to CSS imports and locally linked packages