Skip to content

Conversation

@iqbalhasandev
Copy link
Member

Problem

Import suggestions were not working properly when using components like <Can> from @devwizard/laravel-react-permissions in other projects. Users had to manually import components instead of getting auto-suggestions from their IDE.

Solution

This PR improves the package configuration to ensure proper TypeScript import suggestions:

Changes Made:

  1. Updated package.json exports field - Added proper export maps for better module resolution
  2. Cleaned up index.ts exports - Removed duplicate exports that were causing conflicts
  3. Improved tsup.config.ts - Better TypeScript declaration generation with proper format
  4. Version bump to 1.4.1 - Semantic versioning for the bug fixes

Technical Details:

  • Added explicit exports field in package.json with proper paths for ESM/CJS
  • Updated main, module, and types fields to use correct paths
  • Improved TypeScript declaration generation in build process
  • Updated changelog with the improvements

Testing

After these changes:

  1. Build the package with npm run build
  2. Install in another project with npm i @devwizard/laravel-react-permissions@1.4.1
  3. Try importing <Can> component - IDE should now suggest the import automatically

Impact

  • ✅ Fixes import suggestion issues in IDEs (VS Code, WebStorm, etc.)
  • ✅ Maintains backward compatibility
  • ✅ Improves developer experience when using the package
  • ✅ No breaking changes to existing functionality

Resolves the import suggestion problems reported in development.

- Updated package.json exports field for better module resolution
- Cleaned up index.ts exports to avoid conflicts  
- Improved tsup.config.ts for better TypeScript declaration generation
- Added proper export maps for main, types, and module fields
- Version bump to 1.4.1 for the fixes

This should resolve issues with IDE import suggestions not working properly 
when using components like <Can> from @devwizard/laravel-react-permissions
@iqbalhasandev iqbalhasandev merged commit 3348c00 into main Aug 31, 2025
1 check passed
@iqbalhasandev iqbalhasandev deleted the fix/improve-import-suggestions branch August 31, 2025 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants