react-tabs-scrollable icon indicating copy to clipboard operation
react-tabs-scrollable copied to clipboard

fix: export of rts.css

Open Pegase745 opened this issue 1 year ago • 4 comments

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.

Pegase745 avatar Oct 10 '24 08:10 Pegase745

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

vercel[bot] avatar Oct 10 '24 08:10 vercel[bot]

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

Pegase745 avatar Jan 22 '25 20:01 Pegase745

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.

Mood-al avatar Jan 22 '25 22:01 Mood-al

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

Pegase745 avatar Jan 22 '25 23:01 Pegase745