Skip to content

fix: export of rts.css #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

Pegase745
Copy link

@Pegase745 Pegase745 commented Oct 10, 2024

Thanks for the nice library 👋

When importing the styles from a CSS file like so @import 'react-tabs-scrollable/dist/rts.css';, webpack failed because of how the exports were made in the package.json.

ERROR in ./src/index.css (./node_modules/.pnpm/[email protected][email protected]_@[email protected][email protected]_/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[7].use[1]!./src/index.css)
Module build failed (from ./node_modules/.pnpm/[email protected][email protected]_@[email protected][email protected]_/node_modules/css-loader/dist/cjs.js):
Error: Package path ./dist/rts.css is not exported from package /<project_path>/node_modules/react-tabs-scrollable (see exports field in /<project_path>/node_modules/react-tabs-scrollable/package.json)

In this PR you can find the tested fix for this error. Thanks in advance.

EDIT: Importing import 'react-tabs-scrollable/dist/rts.css'; in a TSX file, will still work.

Copy link

vercel bot commented Oct 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-tabs-scrollable ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 10, 2024 8:40am

@Pegase745
Copy link
Author

Pegase745 commented Jan 22, 2025

Hey @Mood-al, could you please share why this PR can't be merged ?

@Mood-al
Copy link
Owner

Mood-al commented Jan 22, 2025

Hey @Pegase745 ,I appreciate your work but I didnt see any reason to change the package.json with your merge since no one had any issue with it.

@Pegase745
Copy link
Author

Hey @Pegase745 ,I appreciate your work but I didn't see any reason to change the package.json with your merge since no one had any issue with it.

The fact that no one has reported this issue yet doesn't mean it's not a real problem that needs fixing. The error occurs in a specific but valid use case - when importing the CSS through @import in CSS files. While there might be workarounds (like importing in TSX), we should strive to support all standard import methods and this is the correct way according to the Node.js package exports specification.

Here's a screenshot of how I am importing this library compared to others in a reusable components library for a design system.
image

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